Takeaways
- 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.
- 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.
- The server should generate a
Location
header field in the response containing a preferred URI reference for the new permanent URI. - The user agent may use the
Location
field value for automatic redirection. - 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.
NoteAlthough 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 forGET
orHEAD
methods and use the308 Permanent Redirect
forPOST
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