我正在使用Codeigniter 3并拥有以下htaccess文件:
RewriteEngine on
# Allow redirect.phps which are setup
RewriteCond %{REQUEST_URI} register.php
RewriteRule ^/?([A-Za-z]{2})/register.php /redirect.php/$1 [NC,L]
RewriteRule ^/?register.php /redirect.php/uk [NC,L]
RewriteRule ^/?([A-Za-z]{2})/images/(.*)$ /images/$1/$2 [NC,L]
RewriteCond %{REQUEST_URI} !^/images/([^/]+)/ [NC]
RewriteCond $1 !^(index\.php|css|jscript|convert\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我已在http://htaccess.mwl.be/上对此进行了测试,格式正确无误,我告诉他们:
大。但由于某种原因,我得到了Codeigniter 404页面? Codeigniter肯定不应该看到我的代码?如果我在index.php文件中放了一个简单的hello + exit,我可以清楚地看到Codeigniter正在传递params,那么究竟我做错了什么?
答案 0 :(得分:1)
尝试像这样更改.htaccess
。
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
或者这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]