Mod-Rewrite rules are breaking 404 routing
Posted
by
Sparky672
on Stack Overflow
See other posts from Stack Overflow
or by Sparky672
Published on 2012-11-17T16:36:52Z
Indexed on
2012/11/17
17:00 UTC
Read the original article
Hit count: 355
mod-rewrite
|http-status-code-404
I am using the following mod-rewrite
in my .htaccess
file:
RewriteRule ^$ pages/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ pages/$1 [L]
The intention is to hide the subdirectory called /pages/
from displaying in the URL.
So this: http://mysite.com/pages/home.html
Will look like this: http://mysite.com/home.html
It works but there are some unintended consequences.
As a direct result of the .htaccess
code I posted above, my 404 routing is no longer working at all. Anything that should trigger a 404 error page is instead generating a 500 Server Error
.
How to fix?
© Stack Overflow or respective owner