httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31210] New: - Problematic competition between mod_rewrite and mod_dir
Date Tue, 14 Sep 2004 03:10:36 GMT
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

           Summary: Problematic competition between mod_rewrite and mod_dir
           Product: Apache httpd-2.0
           Version: 2.0.50
          Platform: Other
               URL: http://rewritetest.queso.org/
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: mod_dir
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: bugzilla-apache@queso.com


I seem to have discovered what I think is a bug in the interaction between
mod_dir and mod_rewrite (at least as it functions on a per-directory basis)
today.  It didn't exist on my old installation (1.3.27); when I moved a site
over to my new installation (2.0.50), the bug reared its head.

Say that you have a server with two files and a directory in its DocumentRoot,
index.php, stuff.txt, and /stuff.  One function of index.php is to include the
text of a file passed in as the query string -- e.g., /index.php?stuff.txt would
include the text of the file stuff.txt.  Now, say that the following .htaccess
file existed:

RewriteEngine on
RewriteRule ^(stuff)$ /index.php?$1.txt [L]

which served to allow people to shorten URLs; instead of /index.php?stuff.txt,
that would allow them to type /stuff and have the rewriting take place internal
to httpd.

The problem here is that there's *also* a directory named /stuff, and while
mod_rewrite sees a match with the URI "/stuff", mod_dir sees a potential
directory name expansion from "/stuff" to "/stuff/".  And the way that it all
comes together is just broken -- the end result is "/stuff/?stuff.txt", which is
 just wrong.

The relevant directory definition in my httpd.conf file is:

<Directory (DocumentRoot directory)>
        Options FollowSymLinks
        RewriteEngine on
        AllowOverride FileInfo AuthConfig Limit Indexes
</Directory>

The virtual host definition is:

<VirtualHost 204.193.152.163>
        ServerName rewritetest.queso.org
        DocumentRoot (DocumentRoot directory)
        CustomLog logs/rewrite-access_log combined
        ErrorLog logs/rewrite-error_log
        DirectoryIndex index.php
        RewriteEngine on
        SuexecUserGroup rewrite rewrite
</VirtualHost>

There aren't any other directives in the httpd.conf file that would affect the
behavior of the host; the order that the LoadModule statements is that mod_dir
is loaded before mod_rewrite.  (While I know that the new API structure is
supposed to make it meaningless what order they are loaded, I also know that
there have been a few edge cases in Bugzilla that showed that it can matter at
times.)

I've put together a test website that shows the problem -- it's (shockingly)
located at http://rewritetest.queso.org/, and there's a slightly more
fleshed-out example there, along with all the relevant sources and log files.

Am I right that this is a bug, or is there something I'm missing in how one
configures mod_rewrite and/or mod_dir?

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


Mime
View raw message