What's the 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.

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.