Apache RewriteMap with multiple RewriteCond not working

292 Views Asked by At

I'm using a RewriteMap and a rule (using the map) with two RedirectCond

RewriteMap  lc int:tolower

RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE|FR|IT|)$ [NC]
RewriteCond %{HTTP:Accept-Language} ^(de|it|fr).*$ [NC]
RewriteRule ^/$ https://${DOMAIN}/${lc:%1}/${lc:%2}/home.html [L,R=302]

but it's not working. Should I use ${lc:%1} or ${lc:$1} ? As per Apache doc we need to use $ for RewriteMap and % for RewriteCond.

1

There are 1 best solutions below

0
Dmitry Surin On

I suppose you have 503 Internal error. You should set

LogLevel alert rewrite:trace3

in your virtual host config (But it's only possible if you have write permissions). And then try to find what's going wrong in your error log. I don't know certain way to solve your problem but this approach is a good opportunity to debug your rules. And for several cases you can use this site for testing your rules. Hope it help.

And yes, you are right. % for RewriteCond, $ for RewriteRule