Overview

The requested resource has been definitively moved to the URL given by the Location headers. A browser redirects to the new URL and search engines update their links to the resource.

Takeaways

  1. The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.
  2. Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.
  3. The server should generate a Location header field in the response containing a preferred URI reference for the new permanent URI.
  4. The user agent may use the Location field value for automatic redirection.
  5. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s).

A 301 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls.

Note

Although the specification requires the method and the body to remain unchanged when the redirection is performed, not all user-agents meet this requirement.

Use the 301 code only as a response for GET or HEAD methods and use the 308 Permanent Redirect for POST methods instead, as the method change is explicitly prohibited with this status.

Example

Client request

GET /index.php HTTP/1.1
Host: www.example.org

Server response

HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/index.asp

Related

Further Reading

Specification

301 Moved Permanently | The HTTP Working Group

301 Moved Permanently

MDN web docs

Location header field

MDN web docs