Proper status code for language redirection (301, 302, … 307)?

Proper status code for language redirection (301, 302, … 307)? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Proper status code for language redirection (301, 302, … 307)? error on your web browser. Problem :


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?


Solution :

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.



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" />

We hope that this article has helped you resolve the seo, redirects, http error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=