subscribe

301 Moved Permanently

301 Moved Permanently tells a client that the resource they’re trying to access has moved to a new location. The server will include the new location in the Location header.

When a client sees this response, it should repeat the same request on the new location, and if it can, it should also update any links it may have had to the old location and update it to the new one.

Example

HTTP/1.1 301 Moved Permanently
Server: Curveball/0.4.2
Location: https://evertpot.com/http/301-moved-permanently

Real-world Usage

According to the specifications, a client should repeat the exact same request on the new location. In practice, a lot of clients don’t do this.

The reality is that when many clients do something like a POST request on a resource that responds with a 301, almost every client will assume that the POST was successful and do a GET request on the new resource for additional information, including browsers.

This incorrect behavior was so common, that when the HTTP specifications were updated, the newer documents mention this behavior. In addition, a new status-code was introduced later that restored the original behavior: 308 Permanent Redirect.

References

HTTP series

This article is part of a series about the HTTP protocol. Read them all here:

Informational 1xx

Successful 2xx

Redirection 3xx

Client Error 4xx

Server Error 5xx

Web mentions