0

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.

Justin Iurman
  • 18,954
  • 3
  • 35
  • 54
Navrattan Yadav
  • 1,993
  • 1
  • 17
  • 22
  • What is `${DOMAIN}` ? Also, what do you mean by `not working` ? Do you try it directly inside the apache config file or in a htaccess ? To answer your question, `${lc:%1}` is the right way since `%N` are references for condition matching, while `$N` are references for rule matching – Justin Iurman Jul 17 '18 at 14:45

1 Answers1

0

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

Dmitry Surin
  • 153
  • 9