I'm setting up a mod_rewrite
rule that redirects failing pages to a custom "Page Not Found" page. This is with WordPress. I've used an online tutorial from the Apache site and so far my rules look like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) http://example.com/?page_id=254 [R]
This works. It seems to be a combination of the first and second suggestion that worked, since the -U
flag did nothing.
My question is, out of curiosity why the following happens: When I change REQUEST_FILENAME
to REQUEST_URI
(as the second example suggests), the page loads, but none of the style sheets load. All of my formatting is gone, and this happens on every page. Can anyone think of why this might happen?
R
edirect), instead of a 404. TheErrorDocument
is the correct approach as detailed in tadamson's answer.