I do want to automatically redirect users based on the browser locale settings, but at the same time allow users to change their preference and store it.

  • subdomains for specific languages (en.example.com, de.example.com, ...)
  • <link rel="alternate" hreflang="lang_code"... > for all language variations are included in the header of each page (excluding a hreflang="x-default")
  • The automatic redirect only happens on the 'root home page' on https://example.com and only contains a single seo hint: <link rel="alternate" hreflang="x-default" href="http://www.example.com/" />
  • Once a user has clicked on a button to change the language, this preference is stored in a cookie

This way when I visit example.com with a locale preference of "de-de", I get forwarded to de.example.com. I can then change the language to 'fr' via a button on the page. If I close the browser and visit example.com again I will be redirected to 'fr.example.com' because of the preference stored in the cookie.

Is this approach good in terms of SEO?

  • Have you come to a conclusion? We have implemented exactly the same, marking the auto-redirecting home page as "x-default", however many SEO tools flag an error due to "x-default" link being a redirect. Aug 2, 2021 at 3:28

2 Answers 2


Google's John Mueller has spoken about this and advises against using automatic geo-redirects: https://twitter.com/JohnMu/status/877043654472466432

The approach I would suggest is using a modal or notification to inform the user that there is a localised version available for them which they can go to (or decide to stay where they are).

In terms of local indexing, your hreflang tags, as long as they are valid, should do the job. There is an International component with Search Console which you can keep an eye on to see how many hreflang tags have been found / identified and whether any errors were identified.

  • I read about Google's advice not to use auto redirects. However, from experience I can tell you how frustrating it is for end users not to see the website in their language of choice if it is available. After all that's what a browser's locale settings are for. So I'm not talking about IP geo based redirects, but user language preferences. I will try my approach and hopefully it works out as expected. Thanks.
    – Pieter
    Dec 19, 2019 at 15:47

I think there are two separate issues here: usability and SEO.

For usability, yes, you should redirect as you suggested, it's a good idea behavior.

For SEO/Google, you definitely need to implement the correct HREFLANG tags in every page that has a localized version. This means that if you have 4 different homepages, you need to add

    <link rel="alternate" href="https://example.com/" hreflang="en" />
    <link rel="alternate" href="https://es.example.com/" hreflang="es" />
    <link rel="alternate" href="https://de.example.com/" hreflang="de" />
    <link rel="alternate" href="https://fr.example.com/" hreflang="fr" />

to all 4 versions. You need to do this for every single page that is localized, so if you have the same blog article in 4 languages, you need this in all of them:

    <link rel="alternate" href="https://example.com/blog/article123" hreflang="en" />
    <link rel="alternate" href="https://es.example.com/blog/article123" hreflang="es" />
    <link rel="alternate" href="https://de.example.com/blog/article123" hreflang="de" />
    <link rel="alternate" href="https://fr.example.com/blog/article123" hreflang="fr" />

HREFLANG gets really complex really fast, so read up on in - you might want to implement them using an XML sitemap, which might be more manageable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.