Question about mod_rewrite rule for redirecting failing pages

Posted by SimpleCoder on Pro Webmasters See other posts from Pro Webmasters or by SimpleCoder
Published on 2011-02-02T17:10:23Z Indexed on 2011/02/03 7:33 UTC
Read the original article Hit count: 242

Filed under:
|
|

I'm setting up a mod_rewrite rule that redirects failing pages to a custom Page Not Found page. This is with Wordpress. I'm using the guide here: http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide_advanced.html#redirect404. My rule so far looks 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?

© Pro Webmasters or respective owner

Related posts about apache

Related posts about mod-rewrite