301 vs 302 vs 307: A Decision Guide for Link Builders
A redirect looks simple: tell the browser "go here instead." But the status code you return is a signal to browsers, search engines, and analytics tools — and picking the wrong one quietly costs you. Use a 301 for something temporary and you can't change it back. Use a 302 for a permanent move and you may not pass link equity. Misunderstand 307 and you'll break POST submissions.
This guide is the decision tree: what each code means, when to use it, and the specific trade-offs that matter for SEO and link analytics.
The four codes at a glance
| Code | Name | Meaning | Cached? | Preserves method? |
|---|---|---|---|---|
| 301 | Moved Permanently | Permanent move | Yes (aggressively) | No (often → GET) |
| 302 | Found / Temporary | Temporary | No | No (often → GET) |
| 307 | Temporary Redirect | Temporary, method-preserving | No | Yes |
| 308 | Permanent Redirect | Permanent, method-preserving | Yes | Yes |
The two dimensions that decide your choice are permanent vs temporary and method preservation.
301 — the workhorse for SEO
Use 301 when a URL has moved permanently and you want search engines to transfer authority and index the new location. It's the right choice for:
- Migrating to a new domain.
- Restructuring your URL scheme.
- Merging or redirecting old posts to new ones (see link-rot prevention).
The catch: 301s are cached aggressively. Browsers and search engines remember the redirect, so the old URL stops getting hit. That's good for SEO (equity consolidates) but bad for analytics — you lose visibility into clicks on the old URL.
302 — the analytics-friendly choice for short links
Use 302 when the redirect is temporary or, critically, when you still want every request to reach the shortener so you can count clicks.
Short links are a perfect 302 case: the short URL is a stable, permanent address that points at a destination you may change. If you returned a 301, browsers would cache the redirect and bypass the shortener on later visits — so you'd lose click analytics, and you couldn't update the destination without people seeing the old target.
With a 302:
- Every click hits the shortener → click analytics stay accurate.
- You can change the destination at any time → flexibility.
- Search engines still follow it → it's temporary, so no permanent equity shift.
For a URL shortener like yas.sh, 302 is the default for exactly this reason: it keeps the short link as the reliable, measurable entry point.
307 and 308 — when the method matters
Most redirects happen on GET requests (page navigation), so 301/302 are fine. But if the client sent a POST — a form submission, an API call, a payment — then 301 and 302 may switch the method to GET, which breaks the request.
Use 307 (temporary) or 308 (permanent) when you must preserve the method:
- API endpoint moved and clients POST to it → 307/308.
- A form submission endpoint moved → 307/308.
- You need method-safe redirects in your application → 307/308.
308 is the permanent, cacheable version of 307. The trade-off is the same as 301: once cached, it's harder to change.
How this affects your links and analytics
The choice between 301 and 302 for your own links comes down to one question: do you still want to measure and control that URL?
- SEO consolidation wanted, analytics on the old URL not needed → 301.
- You want to keep counting clicks and be able to change the target → 302.
- The URL must preserve POST method → 307/308.
If you're building a short link, the answer is almost always 302 — the whole point of the short link is that it's a stable pointer you can re-target and measure.
The takeaway
Redirect codes are a small decision with big downstream effects. Use 301 for permanent SEO moves, 302 for measurable, re-targetable short links, and 307/308 whenever you must preserve the HTTP method. Match the code to your intent and you keep both your search equity and your click data intact.
If you want to see how a URL actually behaves, run it through the Redirect Tracer — it shows you every hop and status in the chain, so you can confirm your redirects are doing what you think they are.
The full family and when each applies
Redirects are a family of status codes, and each carries a specific meaning about the redirect's permanence and method:
- 301 Moved Permanently — permanent relocation; the original URL should be replaced by the new one. Authority transfers over time.
- 302 Found — a temporary redirect; the original URL stays canonical. The classic "temporary" signal.
- 307 Temporary Redirect — like 302 but explicitly preserving the HTTP method (a
POSTstays aPOST). Introduced to remove the ambiguity of 302. - 308 Permanent Redirect — like 301 but explicitly preserving the method. The permanent counterpart to 307.
The practical distinction runs on two axes: permanent vs temporary, and method-preserving vs not. Choosing correctly on both axes is what makes a redirect behave the way you intend for both browsers and clients.
Why the 302 vs 307 distinction exists
Historically, clients handled a 302 by switching POST to GET, which is why 307 was introduced — it forces the client to preserve the method and body. In practice, for link tracking and most web redirects where the request is a simple GET, 301, 302, and 307 behave nearly identically, and the difference matters mainly when you are redirecting a non-GET request and need the method preserved. Knowing this prevents confusion: for ordinary link redirects you rarely need 307's method preservation, but for form submissions and APIs it is the correct choice.
Matching the code to intent
The decision framework mirrors the 301 vs 302 guide but extends to the full family. Ask two questions: Is the move permanent or temporary? Must the HTTP method be preserved? Permanent + any method → 308; permanent + GET → 301; temporary + preserve method → 307; temporary + GET → 302. For the link-shortener case, where tracking matters, a temporary redirect that passes visitors through the short-link layer is the common choice, while permanent content moves use 301. Matching the code to the real intent keeps search engines and analytics honest.
Practical considerations in deployment
Beyond the code itself, a few practical details matter: use absolute URLs in the Location header, be consistent across the site so you do not mix signals, and test that the redirect reaches the final destination with the right code. Also be aware that search engines treat 301 and 302 differently for link equity, so use the permanent code only for genuinely permanent moves. Handled deliberately, the redirect family gives you precise control over how both users and crawlers experience a URL change.
