A redirect is a 3xx response that tells the client 'the resource you want lives elsewhere — request it there.' The new URL rides in the Location header, and the browser or client automatically re-requests it. It looks simple, but the code you choose decides whether the HTTP method and body are preserved on the re-request, and it affects SEO.
GET /old-page HTTP/1.1
Host: example.com
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Permanent vs temporary: 301 / 302
301 Moved Permanently means the resource has moved for good. Search engines update their index to the new URL and pass most of the link equity along. Browsers cache 301 aggressively, so a mistaken 301 in production is painful to undo. 302 Found is a temporary move: the original URL is still canonical, and search indexes keep pointing at it.
The method-preservation trap: 302 / 303 / 307 / 308
Historically 302 was underspecified, so many clients rewrote an original POST to a GET after redirecting. To end that confusion, explicit codes were added:
- 303 See Other: Always re-request with
GETafter redirecting. The classic pattern for sending aPOSTresult to a page (PRG, Post/Redirect/Get). - 307 Temporary Redirect: Temporary, but preserves method and body. If it was a
POST, it re-sendsPOSTwith the body to the new URL. - 308 Permanent Redirect: Permanent and method/body-preserving — the method-safe version of 301.
- Summary: 301/308 = permanent, 302/307 = temporary. 307/308 preserve the method, 303 forces GET, and 301/302 are inconsistent across clients (POST may become GET).
The practical rule is short: use 307/308 for API redirects where the method must survive, 301 for permanent moves of human-facing pages, and 303 to send a form submission to its result page.
SEO and link equity
From a search perspective, the code matters. For permanent changes like a domain move or URL restructure, use 301 (or 308) so engines transfer the old page's ranking and backlink value to the new URL. For a temporary promo page that will revert, use 302. Choose wrong and you can lose accumulated ranking or leave stale URLs stuck in the index.
Chains and loops
When one redirect points to another, you get a redirect chain (for example http:// → https:// → https://www.). Each hop adds a round trip, slowing things down and diluting link equity, so send users to the final destination in one hop whenever possible. Worse is a redirect loop — A sends to B, B sends back to A — which clients detect and abort with an error like ERR_TOO_MANY_REDIRECTS. It commonly appears when http↔https or www rules conflict.
Finally, the Location value may be absolute or relative (modern specs permit relative), but absolute URLs are safer for predictability. And any body in a redirect response is usually ignored, so the real content must come from the destination URL.