302 is the HTTP status code for a temporary redirect.

302 Found is the HTTP status code most commonly used for temporary URL redirection.

The 302 status code was defined in the HTTP/1.0 spec (RFC 1945) as Moved Temporarily. Due to a conflict between the specification and widespread user agent behavior when this status code was used with a request method other than GET, the later HTTP/1.1 standard (RFC 2616) changed its name and defined two other status codes that are similar to 302: 303 See Other and 307 Temporary Redirect.

All these status codes indicate temporary URL redirection, which is subject to change in the future, in contrast with the 301 Moved Permanently status code, which indicates the the URL of the page has changed permanently, and that the new URL should be used for all future requests.

In particular, web search engines typically treat a 301 redirect as an indication that the redirected URL should be dropped from their index and replaced with the target URL, whereas temporary (302, 303 and 307) redirects may cause them either not to index the redirected URL at all, or to index the content of the target page under the original redirected URL. The latter behavior used to be more common, but it has sometimes been abused as method of URL hijacking, which has caused many search engines to change the way they treat 302 redirects.

The only difference between the status codes 302, 303 and 307 is what happens when a server returns them in response to a request using a method other than GET. According to the HTTP/1.1 standard, the user agent should request the target URL of a 303 redirect with the GET method, while for 302 and 307 redirects it should use the same method as for the original request (after prompting the user for confirmation, if the method is not GET or HEAD). However, in practice, most browsers instead treat 302 redirects the same way as 303.

For GET requests, which are the overwhelmingly most common type of HTTP request in practice, all these status codes are equivalent (and 302 is most commonly used, for historical reasons). One relatively common situation where the 303 status code is preferred, however, is when redirecting the user to a separate page after processing a form submitted using the POST method (where the intent is not that the data should be re-POSTed to the new URL).

See also:

history | excerpt history