https://issues.apache.org/bugzilla/show_bug.cgi?id=57298

            Bug ID: 57298
           Summary: RewriteBase inside FilesMatch behaves oddly
           Product: Apache httpd-2
           Version: 2.4.10
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: mod_rewrite
          Assignee: [email protected]
          Reporter: [email protected]

I have the following somewhat redundant .htaccess file in the directory
/home/jan/public_html/rewrite_test

<FilesMatch "a\.html">
RewriteEngine On
RewriteBase /~jan/rewrite_test/
RewriteRule (.*)a\.html $1.html
</FilesMatch>

Without the <FilesMatch> directive, this works perfectly. If we access
http://localhost/~jan/rewrite_test/1a.html, it serves up the 1.html file
instead.

With the <FilesMatch> directive, it fails. In the log file we see all going
well until this happens:

[Tue Dec 02 15:55:21.365666 2014] [rewrite:trace2] [pid 2020]
mod_rewrite.c(475): [client ::1:58291] ::1 - -
[localhost/sid#7f14dc162448][rid#7f14dbfbf0a0/initial] [perdir a\\.html/]
trying to replace prefix a\\.html/ with /~jan/rewrite_test/

Without the <FilesMatch> it tries to replace the prefix
"/home/jan/public_html/rewrite_test/", and that works fine. But the
<FilesMatch> directive has confused it to the extent that it no longer seems to
remember the directory prefix it is supposed to be replacing, and is using the
argument from <FilesMatch>, "a\\.html\" instead. (Possibly it is mistaking the
<FilesMatch> block for a <Directory> block.)

I'm not completely convinced it ever really makes a lot of sense to put Rewrite
Rules inside a <FilesMatch> block, but it seems like it ought to work, and
mostly it does except that RewriteBase breaks.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to