B.7 Debugging Rewrites That Result in "Not Found" Errors
If your
RewriteRule directives keep resulting in 404 Not
Found error pages, add the PT (PassThrough) flag
to the RewriteRule line. Without this flag, Apache
won't process a lot of other factors that might
apply, such as Alias settings.
You can verify that this is the cause of your problem by cranking the
mod_rewrite logging level up to 9 and seeing
that the entries relating to the RewriteRule mention something about
prefixes with document_root:
RewriteLog logs/rewrite-log
RewriteLogLevel 9
% tail logs/rewrite_log
ip-address - - [date ] [reqid ] (2) prefixed with document_root to /usr/local/apache/htdocs/robots.text
ip-address - - [date ] [reqid ] (1) go-ahead with /usr/local/apache/htdocs/robots.text [OK]
|
Don't forget to turn off the
RewriteLog directive, or possibly just turn down
the logging level, after you've done your checking!
Otherwise your disk space may disappear like the snows of yesteryear.
|
|
Without the PT flag,
mod_rewrite assumes that any rewriting it does
will be the last URL manipulation the server needs to do for the
request. Since mod_rewrite directives are
handled very early in request processing, this can mean that
Alias, ScriptAlias, and other
URL manipulations may not get executed. Specifying the flag tells
mod_rewrite to not short-circuit processing, but
let it continue as usual.
|