301 Moved Permanently

The HTTP 301 status code means a requested resource has been moved to a different URL once and for all, and from now on, clients should look for this resource in a new location (as indicated in the Location header):

HTTP/2 301 Moved Permanently
Location: https://example.com/new

POST requests

Like with 302 Found, some browsers have been incorrectly converting POST requests to GET requests upon encountering a 301 status code. In such cases, POST data is discarded during a redirect, which goes against the HTTP spec, which states that the client should repeat the request with the same method and body.

If you want to be sure that the request will be retried with the same method and body, use 308 Permanent Redirect.

Request Method Permanent Temporary
Can change from POST to GET 301 302
Can’t change from POST to GET 308 307

Search engines

Upon encountering 301, search engines will eventually remove the page from their indexes and pass most, if not all, of the domain authority (aka link juice) to the new page.

Try it yourself

Unlike browsers, most HTTP clients won’t follow redirects; you have to explicitly enable this behavior. For example, to follow redirects in curl, you will have to pass the -L, --location option:

curl -L http://httpguides.com

If your HTTP library doesn’t automatically follow redirects, you will have to extract the Location header and recursively follow it until you receive a non-3xx code.