Permanent and temporary redirects
An HTTP redirect response can tell a browser or other program that a page or other web resource is available at another address, either for a lasting move or temporarily. The response uses a 3xx status code and usually a response field called the Location header that identifies the destination. Common choices are 301 or 308 for a permanent move and 302 or 307 for a temporary move.
Which redirect code should a site use?
The main difference is what the server says about the move and whether the request method, the action requested by the browser, must stay the same:
301 Moved Permanentlyand308 Permanent Redirectdescribe a permanent move. A client may update future references to use the new address.302 Foundand307 Temporary Redirectdescribe a temporary move. The client should continue to use the original address for future requests.307and308require a client that follows the redirect to preserve the request method. With301or302, clients may change aPOSTrequest, used to submit data, toGET, used to retrieve a resource, in some circumstances.
For example, if a site permanently moves an article from /old-guide to /guide, it can use a permanent redirect so visitors and tools learn the new location. If the site sends visitors to a temporary maintenance page for an hour, a temporary redirect better communicates that the original address remains the one to use later.
The status code alone does not guarantee that every browser or cache will behave identically. Redirects may be saved for reuse when the response allows it, and a client can choose how to handle a redirect. A permanent redirect is also different from a DNS change: it is an HTTP response from a server.
Related terms
- Redirect — explains how an HTTP redirect works
- HTTP status code — explains response codes generally
- Redirect loop — an error that can involve redirect rules