【发布时间】:2011-03-13 10:27:04
【问题描述】:
在我的 htaccess 文件中,我的 ErrorDocument 404 语句没有重定向到 index.php。相反,我收到了一个常规的 404 错误。这是一个常规的 apache 安装。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
【问题讨论】:
-
可怜的你!我真的希望你能解决这个问题
-
你用哪个浏览器来测试这个?
-
你知道你是否开启了mod_rewrite(你可以通过
echo phpinfo()查看)?另外,“常规404”是什么意思。你是说 Apache 的 404 还是 CI 的? -
尝试使用其他浏览器。如果某些浏览器获得某些状态代码(例如,404 而不是 200),则某些浏览器不会显示响应的内容。另外,mod_rewrite 是否启用?
标签: .htaccess codeigniter http-status-code-404