Codeigniter htaccess not working on godaddy?

夙愿已清 提交于 2020-01-11 11:29:34

问题


I recently moved to godaddy Linux hosting and the .htaccess doesn't seem to work. Are there any settings which need to be done for godaddy because the .htaccess was working on local xampp server as well as hostek server.I am getting "404 Not Found" error message.i am using CodeIgniter-2.2.1 framework also i have check mod_rewrite in Loaded Modules in php.ini file was not found enable from server side .

My htaccess file located on root directory where my application is deployed.

RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Please suggest.


回答1:


This is work for me:

RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]



回答2:


change your

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

to like

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]



回答3:


use this

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

in config.php

$config['base_url'] = "";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";

EDIT 01

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]



回答4:


Working one on Godaddy shared:

RewriteEngine on
RewriteBase /
Options -Indexes
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/\?$1 [L]



回答5:


<ifmodule mod_rewrite.c>

  # !IMPORTANT! Set your RewriteBase here and don't forget trailing     and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /path_to/your_website/index.php?$1 [L,QSA] 
</IfModule>


来源:https://stackoverflow.com/questions/30522085/codeigniter-htaccess-not-working-on-godaddy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!