Skip to content

Redirect local visitors to specific subdomains

Create a redirect rule to redirect United Kingdom and France visitors from the `example.com` website's root path (`/`) to their localized subdomains `https://gb.example.com` and `https://fr.example.com`, respectively.

This example dynamic redirect for zone example.com will redirect United Kingdom and France visitors requesting the website’s root path (/) to their localized subdomains https://gb.example.com and https://fr.example.com, respectively.

Example

When incoming requests match

Using the Expression Editor:
(ip.geoip.country eq "GB" or ip.geoip.country eq "FR") and http.request.uri.path eq "/"

Then

  • Type: Dynamic
  • Expression: lower(concat("https://", ip.geoip.country, ".example.com"))
  • Status code: 301

For example, the redirect rule would perform the following redirects:

Visitor countryRequest URLTarget URLStatus code
United Kingdomexample.comhttps://gb.example.com301
Franceexample.comhttps://fr.example.com301
United Statesexample.com(unchanged)n/a