301 Moved Permanently
HTTP response status code 301 Moved Permanently is returned by the server to indicate that the resource has been given a new permanent location.
The HTTP response is cacheable by default. If the default behavior needs to be overridden then the HTTP response must include the appropriate HTTP caching headers.
When the 301 Moved Permanently status code is received, clients are expected to update their stored links to the new URI. The new URI is specified by the Location HTTP header and can be used by the client for automatic redirection.
This message might be sent by servers that have migrated to a new domain, or have reorganized their internal file structure, and do not plan on reverting to the former URI.
301 Moved Permanently status code allows for the client to change the HTTP request. For example, if the original HTTP request is a HTTP POST request then the follow-up may be a HTTP GET request. This differs from the 308 Permanent Redirect status code, which requires that an identical request be sent in HTTP response.
In the example, the client attempts to retrieve an HTML resource. The server responds to say that the resource has permanently moved to a new URI and includes it in the Location HTTP header. Client-side, a message is presented in the message body to suggest updating the relevant bookmarks, however this is seldom visible in modern browsers which straight away redirect to the new location.
GET /news.html HTTP/1.1 Host: www.example.ai
HTTP/1.1 301 Moved Permanently Location: http//www.example.ai/feeds/news.html Content-Type: text/html; charset=UTF-8 Content-Length: 150 <h1>The Newsfeed has moved</h1> <body> The newsfeed has moved permanently to <a href=/feeds/news.html>here</a>. Please update your bookmarks. </body>
Apache HttpComponents Core
The 301 Moved Permanently status code indicates that the resource has moved to a new location that is specified within the HTTP response. Clients are expected to update their internal data accordingly.