Navigation
What does HTTP Status Code 301-Moved Permanently mean?
HTTP Status Code 301-Moved Permanently status code is one of the classes of 3xx(redirection) response code that the resource requested by the client to the server has been definitively transferred to the provided Location Header.
This page is redirected by the browser, and search engines’ links to the resource are updated.
For automated redirection, the user agent MAY utilize the Location field value. A brief hypertext remark with a hyperlink to the updated URI is generally included in the server’s response payload.
However, not all user-agents adhere to the definition, thus you may still find this sort of defective software. So it’s best to use this status for POST methods, and the 308 Permanent Redirect code for GET or HEAD methods, as method changes are clearly banned with this status code 301.
Example
Client request
GET /index.php HTTP/1.1Host: www.example.org |
Server response
HTTP/1.1 301 Moved PermanentlyLocation: http://www.example.org/index.asp |
Location Header Field
In some responses, the Location header field is used to refer to a particular resource in connection to the response. The type of relationship is defined by the combination method of the request and status code semantics.
Location = URI-reference
It only provides a meaning when used with a 3xx (redirection) or 201 (created) status response.
Syntax
Location:<url> |
Example
Location:/index.html |
Status
301 Moved Permanently |
Specifications
Browser compatibility
301 CODE REFERENCES
Rails HTTP Status Symbol | :moved_permanently |
Go HTTP Status Constant | http.StatusMovedPermanently |
Symfony HTTP Status Constant | Response::HTTP_MOVED_PERMANENTLY |
Python2 HTTP Status Constant | httplib.MOVED_PERMANENTLY |
Python3+ HTTP Status Constant | http.client.MOVED_PERMANENTLY |
Python3.5+ HTTP Status Constant | http.HTTPStatus.MOVED_PERMANENTLY |
Related Post
Status Code 101-Switching Protocols |
HTTP Status Code 302 Found |
HTTP Status Code 204 – No Content |
HTTP Status Code 207 Multi-Status |
FAQs
What does HTTP Status Code 301 mean?
301-Moved Permanently status code is one of the classes of 3xx(redirection) response code that the resource requested by the client to the server has been definitively transferred to the provided Location Header.
Why Do 301-Moved Permanently Occur?
Redirection messages, such as those in the 3xx category of HTTP status codes indicate the need for further steps to visit a website when they appear. For example, instead of the HTTP status code 5xx, which indicates a problem between two servers, the 301 moved permanently error is caused by a problem with the incoming website’s link, and not by a problem with the client. However, if the URL is not correctly connected, a 301 error notice will display. 301 problems can also be caused by:
New website construction
a new webpage has been launched
Conclusion
I hope this article was able to help you with your doubts and queries related to the HTTP status code 301(Moved Permanently). Still, if there are any queries related to this topic, feel free to ask in the comment section, we would be happy to assist you. Thank you.
Saurabh Chalise