More
More
302 Found
The resource is temporarily at another address.
- Code
302- Reason phrase
- Found
- Class
- 3xx Redirection
- Defined in
- RFC 9110 section 15.4.3
- Cacheable by default
- No
What it means
Redirection: the client has to take another step, usually following a Location header, to complete the request.
When a server should send it. For a temporary move, where the original URL stays the right one to link to: a login wall, a short campaign, a geo or language choice. If the move is permanent, send 301 instead.
Common causes. Login redirects, A/B tests, short lived campaign links.
What to do. Nothing for visitors. If the move is permanent, change it to 301 so search engines update.
How clients and crawlers treat it
Browsers and HTTP clients. Browsers follow it and do not cache it unless Cache-Control or Expires says so. Like 301, browsers turn a POST into a GET when following it; 307 keeps the method.
Google Search. A weak signal that the redirect target should be canonical; Google may keep the original URL in results. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.
Example response
HTTP/1.1 302 Found Location: https://example.com/login?next=/account Found
How to send 302
location = /old-page {
return 302 https://example.com/new-page;
}
Redirect 302 /old-page https://example.com/new-page
header('Location: https://example.com/new-page', true, 302);
exit;
res.writeHead(302, { Location: 'https://example.com/new-page' });
res.end();
from flask import redirect
return redirect('https://example.com/new-page', code=302)
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 307Temporary RedirectLike 302, but the client must repeat the same method and body at the new address.
- 303See OtherFetch the result from another address with GET.
- 301Moved PermanentlyThe resource has a new permanent address, given in the Location header.
All status codes · All 3xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.