嗨,我有这个htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.htm [L]
ErrorDocument 404 /404.htm
如果我擦除前4行,那么另一段代码(当找不到页面时重定向de404页面)将不再工作。
有什么想法吗?我还希望当它重定向到404.htm时,它不会显示在url框中,这个url
http://www.mypage.com/404.htm
我想看看这个
http://www.mypage.com/fail/search-by-the-user
例如。
尝试以下操作.htaccess
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}'.html -f
RewriteRule ^(.*)$ /$1.html
ErrorDocument 404 /404.html
注意:如果您在localhost上工作,请提及适当的RewriteBase