16

I have build a websites with multiple languages. The URLs look like:

  • http://www.example.com/en/
  • http://www.example.com/de/

If the user access the main domain http://www.example.com/ the web server detects the user's language (Accept-Language header) and redirects him to one of the above URLs.

Until now we have used a Temporary Redirect (302), because the user can return with other language settings and should then be redirected to the other one.

On another question, which advises to use 307:

307 Temporary Redirect

In this case, the request should be repeated with another URI; however, future requests should still use the original URI. In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request. For instance, a POST request should be repeated using another POST request.

The question is: what is the proper status code for language redirection?

2 Answers 2

5

For users either a 302 or 307 redirect is fine. The only practical difference between those and a 301 redirect is caching. Browsers cache a 301 redirect. If the user changes their browser language settings, it would be better if they were able to visit the root page and redirect differently. So using a non-cachable 302 or 307 redirect is appropriate.

Search engine crawlers don't usually send an Accept-Language header. Rather than issue a redirect when no Accept-Language header is present, you should show a page that has links to all the choices. This will allow links to your root page to pass PageRank to all of your languages. If you instead redirect, all your PageRank will be passed to your default language. Your other languages will be missing out.

2
  • > you should show a page that has links to all the choices. --- This is pretty bad for UX though, having to wait through two page loads instead of a quick redirect and a page load. I imagine it's also for the SEO of your landing page. You can always put language links in your footer after you have redirected the user to the language they sent in the Accept-Language header. That way SE crawlers can still read all your links. Sep 14, 2020 at 15:13
  • Almost all users will send a language header and it is appropriate to redirect for those users. You should show a choice when the accept language header is not in the request or in cases in which the accept language header indicates a language that you don't support. Showing a choice is far better than redirecting to the "default" language with the user may not actually understand, and which would prevent crawlers from getting to all of the languages. Sep 14, 2020 at 15:37
2

The problem with automatic redirection based on the user's language is that it could prevent users and search engines from viewing all the versions of your site.

The best approach is to cross link each language version of a page, so the user can reach the desired language with a language selector easily, and search engines won't get confused (besides many having locale-aware crawling, it is still recommended).

For example, if you have Spanish (es) and English (en) pages, then you can specify their proper urls with rel="alternate" hreflang="x" link tag for itself in addition to links to the Spanish and English versions

<link rel="alternate" href="http://example.com/es" hreflang="es" />
<link rel="alternate" href="http://example.com/en" hreflang="en" />
2
  • 1
    OP might probably do this already, but the question is about the root page (example.com/), which doesn’t seem to have any content. Neither users nor bots would miss something if there is a redirect from the root page to the language-specific home pages (assuming that the translations are linked from there, in the way you described).
    – unor
    Jul 2, 2016 at 22:20
  • @unor yep! i have already hreflang. The question is about the root page.
    – ar099968
    Jul 4, 2016 at 7:01

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.