301 Moved Permanently
The resource has a new permanent URL, given in Location. Search engines transfer ranking signals to the target and clients may cache the redirect indefinitely.
At a glance
- Status code
- 301 Moved Permanently
- Class
- 3xx, redirection, further action is needed to complete the request
- Defined in
- RFC 9110
- Cacheable by default
- yes
- Response body
- Optional. Clients follow Location instead.
In detail
301 is a statement about the future, not just this request: every subsequent request for the old URL should go to the new one. That is why it is the right code for a domain move or a permanent restructure.
Use it when the change is permanent and you are willing to live with it. Browsers cache 301 aggressively, sometimes for the life of the profile, so a mistaken 301 is very hard to take back from users who already hit it.
Redirect to the specific equivalent page, not to the home page. A mass redirect to the root is treated as a soft 404 and the old URL's ranking is lost rather than transferred.
Examples
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-path
Cache-Control: max-age=3600Things that catch people out
- Historically clients rewrote POST to GET when following 301. Use 308 if the method and body must survive the redirect.
- Chained redirects lose a little signal at each hop and add a round trip. Redirect straight to the final URL.
- Set Cache-Control on a 301 while you are still unsure. The default is cache forever, and forever is a long time to be wrong.
Try it: HTTP Request Builder
Build a request with any method, headers and body, send it, and read the status line the server returns.
HTTP Request Builder
LOCAL · Browser-OnlyBuild and test HTTP requests with custom headers and body
Authentication
Headers
Generate Code
curl -X GET 'https://api.example.com/endpoint' \
-H 'Content-Type: application/json'Showing a sample URL. Enter your endpoint above to update the snippet.
Related HTTP status codes
All http status codes →302 Found
The resource is temporarily at a different URL. The original URL stays authoritative and should keep being used for future requests.
307 Temporary Redirect
Same as 302 but with a guarantee: the client must repeat the request with the original method and body, so a POST stays a POST.
308 Permanent Redirect
A permanent redirect that preserves the request method and body. This is 301 without the historical POST to GET rewrite.
303 See Other
The result of the request is at another URL, and the client should fetch it with GET regardless of the original method.
304 Not Modified
The cached copy the client already holds is still current, so the server sent no body. This is what makes conditional requests cheap.
305 Use Proxy
Deprecated. It once told the client to repeat the request through the proxy named in Location, which turned out to be a security problem.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL