mod_rewrite不工作codeigniter

时间:2014-04-10 11:33:13

标签: php apache .htaccess codeigniter mod-rewrite

我正在index.php url codeigniter

.htaccess.htaccess移除RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-s RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]

我的application/config/config.php代码:

$config['index_page'] = '';

我的http://localhost/myProject设置:

home controller

现在当我去:http://localhost/myproject/home它可以工作..并调用默认的The requested URL /myproject/home/ was not found on this server.

当我去:http://localhost/myproject/index.php/home它说:

home controller

但是当我去:centos 6.5

它再次起作用并调用默认的windows 8 localhost

我正在使用{{1}},而相同的设置在{{1}}

上完美无缺

请帮助,任何建议或帮助将是一个很大的帮助..提前感谢

2 个答案:

答案 0 :(得分:2)

我已将/etc/httpd/conf/httpd.conf编辑为AllowOverride全部:

<Directory "/var/www/html">

   AllowOverride All

</Directory>

现在它按预期工作......:)

答案 1 :(得分:1)

尝试使用此代码:

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