301 Moved Permanently
The HTTP 301 Moved Permanently
redirection response status code indicates that the requested resource has been permanently moved to the URL in the Location
header.
A browser receiving this status will automatically request the resource at the URL in the Location
header, redirecting the user to the new page.
Search engines receiving this response will attribute links to the original URL to the redirected resource, passing the SEO ranking to the new URL.
Note:
In the Fetch Standard, when a user agent receives a 301
in response to a POST
request, it uses the GET
method in the subsequent redirection request, as permitted by the HTTP specification.
To avoid user agents modifying the request, use 308 Permanent Redirect
instead, as altering the method after a 308
response is prohibited.
Status
301 Moved Permanently
Examples
301 response to a moved resource
The following GET
request is made to a resource with a 301
redirection in place.
GET /en-US/docs/AJAX HTTP/2
Host: developer.mozilla.org
User-Agent: curl/8.6.0
Accept: */*
The response includes the 301
status along with the Location
header that indicates the URL where the resource has moved.
HTTP/2 301
cache-control: max-age=2592000,public
location: /en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data
content-type: text/plain; charset=utf-8
date: Fri, 19 Jul 2024 12:57:17 GMT
content-length: 97
Moved Permanently. Redirecting to /en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data
Specifications
Specification |
---|
HTTP Semantics # status.301 |
See also
- Redirections in HTTP
- HTTP response status codes
308 Permanent Redirect
equivalent to301
, but the request method is not modified302 Found
temporary redirect