Hello and wondering how to redirect correctly for https://domain.com to https://domain.com/a if users browse from country A.
Appreciate for any detailed instructions such as which field, operator, value, redirect type, url to redirect to, code 30x and Preserve query string or not.
Please post exactly what you tried, and what didn’t work. (Too many redirects? Didn’t detect country properly? etc.) Post screenshots of any error messages.
I tried this and it gave “redirect to many times” error:
(http.host eq “domain.com” and ip.geoip.country eq “US”)
then static redirect to https://domain.com/us (not Preserve query string)
I tried this (with /) and it did not redirect:
(http.host eq “domain.com/” and ip.geoip.country eq “US”)
then static redirect to https://domain.com/us (not Preserve query string)
The hostname (http.host) does not include “/”, which is a path element. So the first expression is right. To avoid the redirect loop you need to exclude requests that have already been redirected, as shown in the example I gave you.
Thank you! So here is the settings I got:
(http.host eq “domain.com” and not starts_with(http.request.uri.path, “/us”) and ip.geoip.country eq “US”) then static redirect to 'https://domain.com/us
It seems to work but then any visit to 'domain.com/page other than /us redirected to /us. Is there any other settings that can help redirect as above but still able to visit any other page on 'domain.com?
I want only the homepage redirected to /us for us visitors and same for any other countries. And visitors (anywhere) can visit any page or 'sub.domain.com, for example US visitors when visiting the homepage will be redirected to 'domain.com/us but if they are able visit 'domain.com/any-page.
Thanks so much,