Mailing List Archive

Expression syntax in Redirects outside <Location>
I wanted to use expression syntax in a .htaccess redirect, like this
example:

<If "%{HTTPS} != 'on'">
Redirect 301 https://%{HTTP_HOST}%{REQUEST_URI}
</If>

This doesn't work out of the box, though, due to lines 291-294 of:

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_alias.c?annotate=1894034#l291

Those lines restrict expressions in redirects to "<Location> context
only for now", but it's not clear to me why that restriction is needed.

When I patch httpd to remove that restriction, the above example seems
to work fine from a .htaccess file.

Does anyone know why that restriction is there -- and what else would
need to be changed to remove it? Being able to use expression variables
in redirect targets in a .htaccess file seems generally useful.

--
Robert L Mathews