Bug 29576 - Content negotitation (MultiViews) occurs before mod_rewrite leading to odd results
Summary: Content negotitation (MultiViews) occurs before mod_rewrite leading to odd re...
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_negotiation (show other bugs)
Version: 2.0.49
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2004-06-15 14:27 UTC by Luke Ross
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Luke Ross 2004-06-15 14:27:18 UTC
If a directory has both MultiViews (possibly inherited from a parent) and
RewriteRules, the MultiView lookup is done before the Rewrite. This can result
in odd errors.

To demonstrate:
1. Create two directories and enable Multiviews in both of them
2. Create a file in each, with the same stem but different extensions (say,
A.html and A.shtml).
3. Verify you can access them as /dir1/A and /dir2/A
4. Now put in a RewriteRule on dir1 that redirects requests to dir2.
5. Get a 404 Not found error for "/dir2/A.html" when accessing /dir1/A

Here the sequence of events is:

 /dir1/A -> /dir1/A.html (MultiView)
 /dir1/A.html -> /dir2/A.html (Rewrite)
 /dir2/A.html not found

I believe it should be:

 /dir1/A -> /dir2/A (Rewrite)
 /dir2/A -> /dir2/A.shtml
 /dir2/A.shtml found
Comment 1 André Malo 2004-06-15 14:41:21 UTC
Yes, that's the way Rewriterules in directory context work (after the file has
been determined). Use RewriteRules in server context or more tricky ones in
directory context (using the original URL for rewriting or such)