| Status code | 301 |
|---|---|
| Status text | Moved Permanently |
| Category | 3xx Redirection |
| Response has body | Usually |
| Specification | RFC 9110 |
What does 301 Moved Permanently mean?
The resource has permanently moved to the URL in the Location header. It belongs to the 3xx Redirection class, which means further action is needed to complete the request, usually following a different URL.
When do APIs return 301?
A domain migration, an HTTP-to-HTTPS upgrade, or an API version being retired.
How to fix a 301 Moved Permanently
Update your stored URL to the target in Location. Leaving old URLs in client code means every request pays a redirect round trip.
Reproduce a 301 response
The fastest way to understand a status code is to trigger one and read the full response. Open the
API tester and send a request to https://httpbin.org/status/301 — you will
see the 301 status along with every response header the server sent. Comparing those headers against
a working request is often what reveals the cause.
When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.
Related 3xx status codes
300 Multiple Choices
The resource has more than one representation, and the server is leaving the choice to the client.
302 Found
The resource is temporarily at a different URL, but future requests should still use the original.
303 See Other
The response to the request can be found at another URL, and should be retrieved with GET.
304 Not Modified
The cached copy the client already has is still valid, so no body is sent.
307 Temporary Redirect
Like 302, but the HTTP method and body must be preserved when following the redirect.
308 Permanent Redirect
Like 301, but the method and body must be preserved.
301 Moved Permanently FAQ
What is the difference between a 301 and a 302 redirect?
301 says the resource has moved for good, so clients and search engines should use the new URL from now on. 302 says the move is temporary and the original URL should still be used for future requests.
Does a 301 redirect change a POST into a GET?
It can. For historical reasons most clients re-send a redirected POST as a GET after a 301. If the method and body must be preserved, use 308 Permanent Redirect.
Are 301 redirects cached?
Yes. A 301 is cacheable by default and browsers can remember it for a long time, which makes a mistaken 301 hard to undo for people who have already followed it. Test with a 302 first if you are unsure.
See also
- 302 Found — The resource is temporarily at a different URL, but future requests should still use the original.
- 308 Permanent Redirect — Like 301, but the method and body must be preserved.
References
- RFC 9110, 301 Moved Permanently — The specification that defines this status code.
- MDN: 301 Moved Permanently — MDN's reference page for this status code.