Serving a page in English, EG:


Has the following meta tags:

<meta rel="alternate" href="https://www.example.com/fr/make-games" hreflang="fr" />
<meta rel="alternate" href="https://www.example.com/de/make-games" hreflang="de" />
<meta rel="alternate" href="https://www.example.com/zh/make-games" hreflang="zh" />

My issue is:

  • When a new visitor visits the site, if no language tag is set (eg https://www.example.com/make-games it will make a guess as to which version of the site to server and 302 redirect them (eg to https://www.example.com/de/make-games)
  • It will then save a cookie on their computer saying their language is de (saves to their account if logged in etc)
  • Future requests where the cookie exists will automatically redirect to the de version

This concerns me from a crawling point of view, as if the crawler has the cookie set when crawling the site they will never be able to visit the alternative URLs, it will 302 redirect them back to the language they originally viewed.

What's the best way to handle this? One possible solution would be to have the alternative URLs along the lines of:


Which stops the auto redirect. Is this a reasonable solution?

  • First, search engine crawlers don't support cookies. They never get set and they never get sent back. What you need to make sure you support for search engines is clients with cookies disabled. Googlebot also doesn't reliably set an Accept-Language header and it does foreign language crawling from the US. Language redirects can be very problematic for bots, but not for the reasons you outlined above. Oct 2, 2018 at 10:49
  • Second, are you redirecting when the language is specified in the URL? If somebody with a German cookie wanted to look at the French version and hit the French URL directly, would the be allowed to do so or would they get redirected? It is bad practice to redirect when the language is in the URL even if the cookie doesn't match, the browser language is set different, or the IP address is from a different country. In other words your forceLang should be the default behavior for any URL that contains the language code. Oct 2, 2018 at 10:52
  • Thanks @StephenOstermiller, understood RE google and Cookies. Currently site will redirect if their cookie has a different language, they either need to wipe their cookies or select a different language in the footer that sets the cookies. Reason for this is it's more robust as the way the site currently is (fairly large) we can't guarantee all the links on the page correctly format to the current language. On the occasion it's not correctly formatted it will redirect without the user noticing.
    – Tom Gullen
    Oct 2, 2018 at 14:35
  • As Googlebot doesn't use cookies, it feels safe to not have forceLang in the URLs, however I do want to future proof it and allow other bots to be able to crawl that may allow cookies to be set.
    – Tom Gullen
    Oct 2, 2018 at 14:37
  • Why can't you guarantee the correct language in links? It is usually fairly trivial to link to the correct thing. Oct 2, 2018 at 15:22

1 Answer 1


Google recommends never to force a redirect and to follow this practice:

Assuming you have a website http://example.com, and two language versions, example.com/de/ and example.com/en/.

  1. user comes on your site (http://example.com or into one of the language folders) for the first time,
  2. you let user select his language, save it into cookie and after this redirect them into the according language folder (/de/ or /en/),
  3. user comes on your site for the second time,
  4. you check the cookie and redirect user into the corresponding language folder, saved in the cookie.

Bots don't work with cookies - this is the cause, why Google recommends to place at http://example.com no automatic or geo-based redirects, but only hreflangs. On this way you let the bot crawl the whole site. If you redirect automatically, you run the risk, Google will crawl, index and rank mostly english site version (because the bot comes from USA, with english-american language and US-IP-address).

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.