为什么不显示404.html页面

时间:2011-02-16 13:59:08

标签: .htaccess

我有这个.htaccess

RewriteEngine On

ErrorDocument 404 /404.html

RewriteBase /

RewriteRule ^$ index\.html

RewriteRule ^(.+)\.html$ index.php?page=$1 [L]

RewriteRule ^robots.txt$ /generator.php?what=robots [L]

RewriteRule ^sitemap.xml$ /generator.php?what=sitemap [L]

如果我去:site.com/blablalblabla 我得到404 NOT FOUND,但它没有显示我的404.html页面。为什么呢?

谢谢

1 个答案:

答案 0 :(得分:0)

恕我直言,如果服务器启动404,404.html将成为新的REQUEST_URI进行转换。新的uri也将覆盖所有重写规则并最终重定向到index.php?page = 404。

尝试添加此规则条件:

RewriteCond %{REQUEST_URI} !^\/404\.html$
RewriteRule ^(.+)\.html$ index.php?page=$1 [L]
相关问题