I have this .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开发者_运维知识库]
If I go at: site.com/blablalblabla I get 404 NOT FOUND, but it doens't show my 404.html page. Why?
Thank you
IMHO if the server fires up a 404, the 404.html will be the new REQUEST_URI to transform. The new uri will also go over all the rewrite rules and ending up redirected to index.php?page=404.
Try do add this rule condition:
RewriteCond %{REQUEST_URI} !^\/404\.html$
RewriteRule ^(.+)\.html$ index.php?page=$1 [L]
Try making a 404.md file with the following inside:
---
permalink: <insert 404 file path here>
---
精彩评论