Using Redirect Rule I want to dynamically redirect all US visitors to https://us.domain.com from https://www.domain.com
Please share the target expression.
1 Like
Hello Asif!
It is really simple to do this withing Cloudflare.
Just go to your Website on the Cloudflare Dashboard, then go to βRulesβ and βRedirect Ruleβ on your left menu.
From there, set a Custom Filter Expression for checking this values:
- Field = Country;
- Operator = Equals;
- Value = United States (or whatever you need).
Set the Redirect Type as Dynamic and use this expression (which actually concatenates your desired FQDN us.domain.com
with the path requested by the client):
concat("https://us.domain.com", http.request.uri.path)
If youβre using them, please consider to flag the Preserve Query String option.
Tried this earlier.
Tested with Speed/Observatory.
Error occurred as below
βIt might have failed because your test URL
domain.com/
was redirected to a different domain.β