You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2004/09/14 20:59:29 UTC

DO NOT REPLY [Bug 31210] - Problematic competition between mod_rewrite and mod_dir

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31210>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31210

Problematic competition between mod_rewrite and mod_dir





------- Additional Comments From samg@unhinged.org  2004-09-14 18:59 -------
mod_rewrite gets the first stab at processing the request. If we look at the
rules described in the bug report, mod_rewrite first changes the URI "/stuff"
into two parts: the base URI "/index.php" and the arguments "stuff.txt".
mod_rewrite can glue these back together, but the component parts are stored in
the request object.

What looks like is happening is that "/stuff" gets left as the URI, the file
gets set to "/index.php", and the arguments get set to "stuff.txt". This
structure gets passed to mod_dir, which adds a slash to the URI and glues on the
argument resulting in an external redirect of "/stuff/?stuff.txt".

Based on the documentation, I believe this is the correct behavior even if it is
neither desirable nor intuitive.  I believe that the way to not encounter this
behavior would be to set the passthrough flag. If PT is set, "/index.php" should
replace "/stuff" as the request URI, and the argument "stuff.txt" still is added
to the URI.

Unfortunately, it looks like PT does not work with a per-directory
configuration. The workaround is to move the rewrite directive from the
.htaccess or <location> config locations and to a server location. 

This comment from the source of mod_rewrite.c is interesting:
> /* if someone used the PASSTHROUGH flag in per-dir
> * context we just ignore it. It is only useful
> * in per-server context
> */
I think this behavior is could be a bug in mod_rewrite. Alternatively, this
behavior should be documented outside of the source code.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org