Reference guide · http-status · Published 2026-08-15 · 4 min read
HTTP 302 and temporary redirects
HTTP 302 temporary redirect explained: when 302 is correct, when to choose 301 instead, and how to keep a temporary swap from becoming a SEO data leak.
- ·302 vs 307
- ·SEO behaviour
- ·When to use
What a 302 is
A 302 Found (historically "Moved Temporarily") says the requested URL is reachable for now at another location, but the URL itself remains the real address. The browser follows the Location header for the request, yet old browser entries, bookmarks, and the local cache are not instructed to swap permanently. The practical result is that the origin URL keeps the value.
The modern, unambiguous temporary code is 307: the two are close semantically, but 307 forbids changing the request method on redirect while 302 historically allowed it. For everyday page redirects either browser response is fine; for APIs with strict method semantics 307 is the safer match.
302 versus 301 in one view
| Aspect | 301 permanent | 302 temporary |
|---|---|---|
| Meaning | URL moved forever | URL borrowed for a while |
| Search value | Carries links and signals to the target | Old URL keeps value, crawlers may still index it |
| 302 to a permanently dead page | Leaks value and confusion | Wrong choice, dead end |
| Example | Moved a blog slug, new product URL | A/B test, banner, promo takeover |
How search engines treat 302 or other temporary
Search engine behavior follows the same rules as browsers, but with a permanent bias. When a crawler lands on a 302, the common heuristic is: render the target as the result for that request while still treating the source URL as the live address. Two practical consequences follow:
- If the temporary redirect is never removed, the crawler keeps collecting both URLs, link equity does not consolidate, and the temporary landing page can outrank the page you meant to keep.
- If you announce a permanent move as 302, or a temporary swap as 301, the classifier usually trusts the status code, so the wrong outcome can stick far longer than the test window you planned.
When to use a 302
- A/B split on the same URL; the winner becomes the real page later.
- A maintenance or promo that the owner will end, for example a short-lived sale page.
- Session or geographic routing, where the same URL really serves a different version per user.
- A page that exists multiple ways, none of which is meant to be the permanent single URL.
When to use a 301
- The URL is gone for good and the target is the new home.
- You need the link equity and rankings to concentrate on a single canonical address.
- You are merging multiple versions of the same content into one page.
The fix order (temporary redirects that last)
- Schedule a review date in your task list when you add the 302; temporary redirects that outlive their plan get treated like a permanent that was never labeled.
- If the swap is likely to be permanent, skip the 302 and set up the 301 from the start. Changing from 302 to 301 later costs a second redirect on the same URL.
- For an A/B test, never mix status: the same URL should not be a 302 in one environment and a 301 in another.
- Use curl against the URL after traffic to confirm the plan still says 302 and the Location header points to the intended target.
Verify the response
curl -I https://example.com/sale/
HTTP/2 302
location: https://example.com/offers/
Prevention
- Make every redirect pass through a single rule you can diff.
- When a temporary test ends, remove or finish the landing in the same deploy that ends the test.
- Prefer 307 for APIs and streaming responses to avoid method rewriting.
When to use a 301 instead
The boundary is simple: permanent content and SEO equity wants 301; experiments, events, and short-lived swaps want 302 or 307.