302 Found
The resource is at another address for the time being. Clients go there now and keep using the original address in future.
- Class
- 3xx Redirection. The client has to take another step to finish the request, usually fetching a different address.
- Defined in
- RFC 9110
- Also known as
- Moved Temporarily
What it looks like
HTTP/1.1 302 Found Location: /login?next=%2Faccount
When a server sends it
For anything that is not meant to last: a login page in front of protected content, a campaign, a page that is briefly somewhere else, a redirect by country or language. The Location header gives the address to go to.
What to do with it
Clients follow it and don't remember it, so the next request goes to the original address again. If the move is in fact permanent, change it to a 301.
When a POST is redirected with a 302, browsers and most libraries repeat it as a GET without the body. Use 307 if the POST has to stay a POST, and 303 if the switch to GET is what you want.
Not to be confused with
| 301 Moved Permanently | The move is permanent. |
|---|---|
| 303 See Other | Says outright that the next request has to be a GET. |
| 307 Temporary Redirect | Temporary too, and the method and body must stay the same. |
How Google treats it
Google follows the redirect and treats a 302 as a weak signal about the new address, where a 301 is a strong one.
All codes are on the list of HTTP status codes, which can be searched by number and by word.