Version: Apache 2.4.10 (Debian Jessy), worker MPM
This works how I expect:
<VirtualHost *:80>
DocumentRoot /var/www/html
LogLevel trace8
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/dir/file2.html
RewriteRule .* /var/www/html/file2.html [L]
</VirtualHost>
Debug log: https://pastebin.ca/raw/3107063
It recognizes /var/www/html/file2.html as a local path and serves up that file.
This does not work the same:
<VirtualHost *:80>
DocumentRoot /var/www/html
LogLevel trace8
RewriteEngine on
<If "1 -eq 1">
RewriteCond %{REQUEST_URI} ^/dir/file2.html
RewriteRule .* /var/www/html/file2.html [L]
</If>
</VirtualHost>
Debug log: https://pastebin.ca/raw/3107064
Adding the <If> causes Apache to treat /var/www/html/file2.html as a URI and
now an internal redirect is made, and the request fails (and that is just not
what should happen). The <If> expression doesn't matter, any matching
expression acts the same. I've tried lots of variations such as [END] and
different directories and paths and gotten the same result. The important part
is that just adding <If> makes the rewrite act very different.
I'm not looking for an alternative or a workaround, I actually need to know why
the <If> causes this to happen. It seems like a bug to me. I haven't tried
2.4.16 but there are no related changelog entries between 2.4.10 and 2.4.16.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]