7

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?

1

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" />
  • 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 '16 at 22:20
  • @unor yep! i have already hreflang. The question is about the root page. – ar099968 Jul 4 '16 at 7:01
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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