301 vs 302 Redirect: Differences, SEO Impact, 307 and 308
A 301 vs 302 redirect choice tells browsers and search engines whether a move is permanent or temporary. Learn what each status code means, how 307 and 308 differ by preserving the request method, what happens to POST data, how search engines treat each one, and why chains and loops hurt, with a local server we tested.
- The 301 vs 302 redirect difference is permanent versus temporary: 301 says “use the new URL from now on”, 302 says “go there for now”.
- 307 and 308 are the strict versions of 302 and 301: they must keep the request method and body.
- In our test, a POST to a 301 or 302 came back as a GET with an empty body; for 307 and 308 the Python client refused to redirect the POST at all.
- Search engines consolidate signals to the target of a permanent redirect; use 301 or 308 for real moves.
You moved a page, changed a domain, switched to HTTPS or renamed a product URL. A redirect sends visitors and crawlers from the old address to the new one, but which status code you use decides how browsers cache it, how search engines index it and what happens to form submissions. Choosing between a 301 vs 302 redirect, and their newer siblings 307 and 308, takes one minute once you know the rules.
We built a small Python server (Python 3.13.6, standard library) that returns each redirect type, then called it with Python’s HTTP clients to see exactly what happens. Search engine behaviour comes from published documentation and widely reported tests, which we summarise rather than ran.
301 vs 302: the short answer
| Aspect | 301 | 302 |
|---|---|---|
| Meaning | Moved permanently | Found elsewhere, temporarily |
| Browser caching | Cached by default, often for a long time | Not cached unless headers say so |
| Search engines | Index the new URL, consolidate signals to it | Usually keep the old URL indexed |
| Use for | Page moves, domain changes, HTTPS, merged content | Short promotions, A/B tests, maintenance pages |
How a redirect works
raw GET /old-301: 301 Moved Permanently, Location: /target
raw GET /old-302: 302 Found, Location: /target
raw GET /old-307: 307 Temporary Redirect, Location: /target
raw GET /old-308: 308 Permanent Redirect, Location: /target
The server answers the original request with a 3xx status code and a Location header naming the new address. The client then makes a second request to that address. Our raw requests above show each server response before any client follows it. The status code is the only thing that differs between the four, and it carries two pieces of information: permanent or temporary, and whether the method must be preserved.
301 Moved Permanently
A 301 says the resource has a new permanent URL and clients should use it from now on. Browsers cache 301 responses aggressively, sometimes until the cache is cleared, so a wrong 301 can keep sending users to the wrong place long after you fix the server. Search engines treat the target as the canonical URL and transfer the old page’s ranking signals to it over time. Use 301 for permanent moves of pages and sites.
302 Found
A 302 says the resource is temporarily somewhere else, and the original URL remains the one to use in future. Browsers do not cache it by default. Search engines usually keep the original URL in their index, though if a 302 stays in place for a long time, they may start treating it like a permanent redirect. Use it for genuinely temporary situations: a seasonal landing page, a maintenance notice, a geo-based redirect or sending logged-out users to a sign-in page.
307 and 308: method-preserving redirects
Historically, browsers turned a POST into a GET when following 301 and 302 redirects, even though the original specification did not intend that. To remove the ambiguity, HTTP added two codes:
- 307 Temporary Redirect: like 302, but the client must repeat the same method and body.
- 308 Permanent Redirect: like 301, but the method and body must be preserved.
For ordinary page visits, which are GET requests, 307 behaves like 302 and 308 like 301. They matter for APIs and form submissions, where silently turning a POST into a GET loses data.
All four redirect codes compared
| Code | Permanent? | Method and body kept? | Typical use |
|---|---|---|---|
| 301 | Yes | Not guaranteed (POST often becomes GET) | Page and domain moves |
| 302 | No | Not guaranteed | Temporary page redirects |
| 307 | No | Yes | Temporary API redirects, HSTS upgrades in browsers |
| 308 | Yes | Yes | Permanent API endpoint moves |
The other 3xx codes are less common: 303 See Other explicitly tells the client to fetch the target with GET (the classic redirect after a form submission), and 304 Not Modified is a caching response, not a redirect; see our HTTP caching guide.
What happens to a POST request
urllib POST /old-301 followed -> 200 {"path": "/target", "method": "GET", "body": ""}
urllib POST /old-302 followed -> 200 {"path": "/target", "method": "GET", "body": ""}
urllib POST /old-307 -> 307 Temporary Redirect
urllib POST /old-308 -> 308 Permanent Redirect
We posted qty=2 to each old URL using Python’s urllib. For 301 and 302, the client followed the redirect but switched to GET and dropped the body: the target received no order data. For 307 and 308, which forbid changing the method, urllib refused to follow automatically and returned the redirect as an error, leaving the decision to the caller. Browsers re-send the POST to the new URL for 307 and 308. Either way, the lesson for APIs is clear: if an endpoint that receives POST, PUT or DELETE moves, use 307 or 308, and better still, update clients to call the new URL directly. Our HTTP methods guide covers why methods matter.
SEO impact of 301 vs 302
- Indexing: after a 301 or 308, search engines replace the old URL with the target in results. After a 302 or 307 they typically keep the old URL.
- Link signals: Google has said that redirects of any type no longer lose PageRank, but a permanent redirect is the clearest signal that signals should consolidate on the new URL.
- Long-lived 302s: if a temporary redirect never goes away, search engines may eventually treat it as permanent, but relying on that is guesswork. Use the right code from the start.
- Internal links: after a move, update your own links to point at the new URL; redirects are a safety net, not a substitute.
- Canonical tags and sitemaps: list only final URLs in sitemaps, and make canonical tags point to the redirect target.
A domain or HTTPS migration also involves DNS changes; see our DNS records guide.
Redirect chains and loops
chain of 3 followed -> /target 200
redirect loop -> 301 HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop
A chain is a redirect to a redirect: /chain1 to /chain2 to /chain3 to /target. Our client followed it, but each hop costs a full round trip, slows the page and dilutes crawl budget. Crawlers stop following after a limit, around ten hops for Google. A loop, where A redirects to B and B back to A, never resolves; the Python client detected it and gave up, and browsers show an error page. Both usually appear after several migrations stack up. Point every old URL straight at its final destination.
Tip: after any migration, crawl your old URL list and confirm each one reaches a 200 in exactly one hop.
Which redirect to use when
| Situation | Code |
|---|---|
| Page URL changed for good | 301 |
| HTTP to HTTPS, or www to non-www | 301 (or 308) |
| Domain migration | 301 |
| Merged two articles into one | 301 to the merged page |
| Temporary promotion or maintenance page | 302 or 307 |
| Redirect after a successful form POST | 303 |
| API endpoint moved permanently | 308 |
| API endpoint temporarily elsewhere | 307 |
Setting up redirects
# nginx
location = /old-page { return 301 /new-page; }
# Apache (.htaccess)
Redirect 301 /old-page /new-page
Server-level redirects are fastest and work for every client. Most CMSs and SEO plugins can manage redirects in their admin screens too. Avoid JavaScript or meta refresh redirects for permanent moves; they are slower and less reliable signals. We did not run the nginx and Apache examples here. For URLs with special characters, our URL encoding guide helps avoid broken targets.
Testing redirects
- Use
curl -I https://example.com/old-pageto see the status code andLocationwithout following. - Check that each old URL reaches the final page in one hop with a 200.
- Test POST endpoints separately if APIs are involved.
- Remember browsers cache 301s; test in a private window after changes.
- Monitor 404s after a migration to catch missed URLs, and see the status codes cheat sheet for other responses.
Final thoughts
The 301 vs 302 redirect decision is about intent: permanent moves get 301, or 308 for APIs that must keep their method; temporary detours get 302, or 307 for APIs. Our tests showed why the method-preserving codes exist, as 301 and 302 turned a POST into an empty GET. Point old URLs straight at their final destination, avoid chains and loops, update internal links, and your users, crawlers and API clients will all end up in the right place.
Frequently asked questions
What is the difference between a 301 and 302 redirect?
A 301 redirect is permanent and tells browsers and search engines to use the new URL from now on. A 302 is temporary, so the original URL stays the one to use and index.
Is 301 or 302 better for SEO?
For permanent moves, 301 is the right choice because search engines index the new URL and consolidate signals to it. Use 302 only for genuinely temporary redirects.
What is the difference between 302 and 307?
Both are temporary. A 307 requires the client to repeat the same method and body, while a 302 may let clients change a POST into a GET.
When should I use a 308 redirect?
Use 308 when a resource has moved permanently and the request method must be preserved, such as an API endpoint that receives POST or PUT requests.
How many redirects are too many?
Aim for one hop from the old URL to the final page. Each extra hop slows loading, and crawlers stop after a limited number of redirects in a chain.
Keep learning
Need help with testing, WordPress or SEO?
We help teams ship better software and grow their sites. Tell us what you are working on and we will suggest a clear next step.