301 vs 302 redirects: which to use, and why SEO cares
A redirect tells the browser "what you asked for lives somewhere else." The status code you choose decides whether that move is treated as permanent or temporary, and getting it wrong has real consequences for search rankings and caching.
The core difference
- 301 Moved Permanently says the resource has moved for good. Browsers and search engines cache it aggressively, and crawlers transfer the old URL's ranking signals to the new one.
- 302 Found says the move is temporary. The original URL is still the canonical one, so search engines keep indexing the old address and do not pass ranking signals to the target.
In one line: 301 for permanent moves, 302 for temporary ones.
Why the choice matters for SEO
Use a 302 for a move that is actually permanent and you may stall: search engines keep the old URL indexed, ranking signals do not consolidate on the new page, and the migration drags. Use a 301 for something genuinely temporary (an A/B test, a seasonal landing page) and search engines may swap the indexed URL for one you meant to revert.
There is also a caching cost. Because 301s are cached hard, a wrong one is painful to undo: browsers that saw it keep following the old redirect long after you change the server, sometimes for as long as the cache lasts.
Where 307 and 308 come in
301 and 302 have a historical quirk: many clients change a POST to a GET when following them. The modern codes fix this:
- 308 Permanent Redirect is a 301 that preserves the HTTP method.
- 307 Temporary Redirect is a 302 that preserves the method.
For APIs and anything handling POST, prefer 308 and 307 so the method survives. (This is why the apex-to-www redirect on many sites is a 308.)
You can look up the exact meaning and method behavior of every redirect code in the HTTP Status Codes reference, and the HTTP status codes explained post covers the wider families.