What's the HTTP Status Code for Permanent Redirect?

HTTP status code for permanent redirect

Both, 301 Moved Permanently and 308 Permanent Redirect HTTP response status codes are used to indicate that the requested resource has been permanently moved to a new URL (as specified by the Location headers). The main difference between the two is that:

  • 301 may sometimes (incorrectly) change a POST request into a GET;
  • 308 does not allow the HTTP method (or the request body) to be changed.

Therefore, you should choose 308 when you're dealing with POST requests, and choose 301 for GET and HEAD requests.

For example, 308 is useful when submitting a form to a permanently redirected resource where you would want the client to make a POST request with the same request body to the new, redirected location. Doing the same with 301, however, might be problematic as the client may choose to change POST to GET (which is typically the case).

Specifying either of these is good for SEO as the indication that the resource has permanently moved to a new URL helps search engines update their links to the resource.

Some old browsers (and other clients such as crawlers, etc.) may not understand the HTTP response status code 308 as it is fairly new (introduced in April 2015). As a result, they may not follow the redirect. In such a case, you can use 301 instead.

Hope you found this post useful. It was published . Please show your love and support by sharing this post.