Codeigniter htaccess没有在godaddy上工作?

时间:2015-05-29 05:54:12

标签: .htaccess codeigniter codeigniter-2

我最近搬到了godaddy Linux主机,而.htaccess似乎没有用。是否有任何设置需要为godaddy完成,因为.htaccess正在本地xampp服务器以及hostek服务器上工作。我得到了#34; 404 Not Found"错误message.i我正在使用CodeIgniter-2.2.1框架我也检查了php.ini文件中的加载模块中的mod_rewrite未找到从服务器端启用。

我的htaccess文件位于部署我的应用程序的根目录。

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

请建议。

5 个答案:

答案 0 :(得分:1)

这对我有用:

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

答案 1 :(得分:0)

使用此

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

在config.php中

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

编辑01

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

答案 2 :(得分:0)

改变你的

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

喜欢

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

答案 3 :(得分:0)

在Godaddy上工作一个人分享:

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]

答案 4 :(得分:0)

<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>