Forum Moderators: phranque
I have a rewritemap that is trying to perform 3 tasks. It looks like
/alias1 /internalredirect?with=vars
/alias2 [external.com...]
[fromexternal.com...] /internalpage
.......
RewriteMap combinedaliases txt:/my/path/aliases.map
and a rule
RewriteCond %{REQUEST_URI} ^(.*)
RewriteCond ${combinedaliases:%1} !^$
RewriteRule ^(.*)$ ${combinedaliases:%1} [NE,L,R]
which handles the first 2 scenarios well.
What I want to do is a second pass through the map concatenating the host as well (the external hosts in line 3 are pointing at this same vhost), but I can't, after much experimentation, figure out how to pass the HTTP_HOST into the map rule
For example, nesting them throws a 500
RewriteCond %{REQUEST_URI} ^(.*)
RewriteCond ${combinedaliases:${HTTP_HOST}%1} !^$
RewriteRule ^(.*)$ ${combinedaliases:${HTTP_HOST}%1} [NE,L,R]
I'm guessing I can't concat them inside the ${} syntax but also can't figure out how to do this outside it...hmm
Any pointers? Thanks
You need not use a RewriteCond to reference %{REQUEST_URI} in this ruleset. This value is already available to your RewriteCond(s) and RewriteRule substitution in $1 as a result of being matched in the RewriteRule's pattern. (See mod_rewrite Ruleset Processing documentation if this is unclear.)
Jim