[英]mod_rewrite not working codeigniter
我正在尝试从codeigniter
usign .htaccess
url
中删除index.php
我的.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
上完美运行
请帮助,任何建议或帮助将是一个很大的帮助..在此先感谢
我已经将/etc/httpd/conf/httpd.conf
编辑为AllowOverride
all:
<Directory "/var/www/html">
AllowOverride All
</Directory>
现在它正在按方面工作... :)
尝试使用以下代码:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.