The 301 (Moved Permanently) status code indicates that 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).
The important thing to consider when using a 301
is that clients will cache
the new url. This is especially true of search engines like Google. Using a
301
means you’re really sure the old url is no longer valid (permanent means
permanent). If this isn’t the case, a 302 Found is a better fit.