Common uses
- Sending a visitor who isn't logged in from
/accountto/login?next=/account. - Pointing a short or campaign URL at a page that will change.
- Showing a maintenance or sale page in place of a normal one for a few days.
- Sending visitors to a language or country version based on their browser or location.
When another code fits better
- The move is permanent: use 301, or 308 to keep the request method.
- A POST must stay a POST with its body: use 307.
- You're redirecting after a form submission to a results page: use 303 See Other, which always switches to GET.
Set up a 302 redirect
Next.js redirect() and NextResponse.redirect() send 307 by default, the temporary redirect that keeps the request method.
# nginx
location = /sale { return 302 /summer-sale; }
# Apache (.htaccess)
Redirect 302 /sale /summer-sale
// Express (302 is the default)
res.redirect("/summer-sale");A 302 that should have been a 301
If a temporary redirect stays in place for months, Google may decide it's permanent and index the target URL. That's usually what the site wanted, but say so directly: when a move is permanent, use 301 or 308.
Frequently asked questions
Is a 302 redirect bad for SEO?
No, when the move really is temporary. The original URL keeps its place in search results. It becomes a problem only when a permanent move is set up as a 302 and the new URL takes longer to replace the old one.
Why does a POST become a GET after a 302?
Early browsers switched to GET when following 301 and 302, and the specification now allows it. Use 307 when the method and body must be sent again.
Is 302 Found the same as 302 Moved Temporarily?
Yes. HTTP/1.0 called it Moved Temporarily, and HTTP/1.1 renamed it Found. It's the same status code with the same meaning.
More http status code lookup guides
- 502 Bad Gateway: What It Means and How to Fix It
- 504 Gateway Timeout: Causes and Fixes
- 429 Too Many Requests: Meaning, Retry-After and Fixes
- 403 Forbidden: Meaning, Causes and How to Fix It
- 401 Unauthorized: What It Means and How to Fix It
- 500 Internal Server Error: Causes and How to Fix It
- 503 Service Unavailable: Causes and Fixes
- 400 Bad Request: Causes and Fixes (Including Cookie Too Large)
- 404 Not Found: What It Means and How to Fix It
- 301 Moved Permanently: Meaning, SEO and Examples
- 408 Request Timeout: Causes and How to Fix It