The language routing rule I redirect to the static domain does infinite redirects

I am trying to redirect users whose browser is Turkish to tr.example.com, I used the following rule for this, but it caused infinite redirect errors.

starts_with(http.request.accepted_languages[0],"tr")

I wonder where am I doing wrong?

What is stopping the rule from being executed on requests to tr.example.com?

The example in the original Blog post for Redirect rules gives a good starting point. You need to exclude requests to the Language specific area of your site. You might also want to account for people accidentally visiting the language specific site (to account for German visitors clicking a link to the Turkish site)

As far as I understand, you mean direct requests coming directly to tr.example.com. So, how can I turn the following expression into a rule so that there is no infinite loop?

For instance

if (starts_with(http.request.accepted_languages[0],"tr") && http_uri_not_start_with != 'tr') {

// redirect
}

By the way in i need just tr language support. default language is always en.

Something like this will do the trick:

(not http.host in {"tr.example.com"} and starts_with(http.request.accepted_languages[0],"tr"))

1 Like

It works fine. Thanks.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.