On this page
Redirects (301/302/308)
HTTP redirects send a client from one URL to another. Use 301 or 308 for permanent moves, 302 or 307 for temporary ones, and never chain more than necessary.
What it is
A redirect is a 3xx HTTP response that tells the client to fetch a different URL, named in the Location header. RFC 9110 defines the semantics of each status code.
HTTP/1.1 301 Moved Permanently
Location: https://example.com/articles/csp
The four codes that matter in practice:
- 301 Moved Permanently - the canonical URL has changed. Search engines transfer ranking signals to the target.
- 302 Found - temporary redirect. The browser may switch the request method (a
POSTcan become aGET). Use only for short-lived redirects. - 307 Temporary Redirect - like 302, but the method and body must be preserved. Safer for APIs.
- 308 Permanent Redirect - like 301, but the method and body must be preserved.
For SEO, treat 301 and 308 as equivalent (“permanent”), and 302 and 307 as equivalent (“temporary”).
Why it matters
When you move a page, every link, bookmark, and search result pointing at the old URL becomes a problem. A permanent redirect tells crawlers to forget the old URL and consolidate ranking signals onto the new one. A temporary redirect tells them the old URL is the canonical one and will return.
Getting this wrong is one of the most common SEO mistakes. A 302 on a URL that has actually moved permanently can take months to be reinterpreted as a 301, during which the site loses traffic.
How to implement
Rules of thumb:
- URL has moved for good → 301 (or 308 if the method matters).
- Site is in maintenance, A/B test, or geo-redirect → 302 (or 307).
- HTTPS upgrade → 301 from
http://tohttps://. - Trailing-slash or case canonicalisation → 301.
- Old domain → new domain → 301. Keep the old domain registered indefinitely so the redirect keeps working.
Keep chains short. Each hop is a fresh request, costs latency, and risks a crawler giving up. A → B → C should be flattened to A → C and B → C wherever you control both rules.
Bad: /old-name → 301 → /new-name → 301 → /new-name/
Good: /old-name → 301 → /new-name/
/new-name → 301 → /new-name/
Other practical points:
- Redirect at the edge (web server, CDN, or origin) - not with
<meta http-equiv="refresh">or JavaScript. Crawlers handle HTTP redirects reliably; meta-refresh and JS redirects are slower and ambiguous. - For 301 chains across a migration, write the redirect map from your old URL inventory, not by guessing.
- Preserve query strings if the destination needs them.
Common mistakes
- Using 302 for a permanent move.
- Redirecting every removed page to the home page. That hides the loss and confuses crawlers - return 410 or 404 instead.
- Redirect loops (
A → B → A). - Chains longer than three hops. Google stops following after about ten; users feel the latency long before that.
IETF RFC 9110 HTTP Redirect Specifications & Method Preservation
Executing HTTP redirects across web applications and API gateways requires following IETF RFC 9110 specifications:
- Permanent vs. Temporary Redirect Semantics: Use HTTP
301 Moved Permanentlyor HTTP308 Permanent Redirectwhen a resource URL changes permanently, signalling search engines to transfer PageRank signals to the target URL. Use HTTP302 Foundor HTTP307 Temporary Redirectfor temporary moves. - HTTP Method Preservation (
307and308): Legacy 301/302 redirects permit client browsers to rewrite HTTPPOSTrequests intoGETrequests, stripping request body payloads. RFC 9110 specifies that HTTP 307 and 308 redirects MUST preserve the original HTTP method and body payload intact across the redirect hop. - PageRank Signal Consolidation: HTTP 301 redirects transfer the source page’s inbound link equity to the redirect target. Each additional hop in a redirect chain dilutes this signal. Broken chains - where an intermediate redirect target returns a 404 - lose all transferred link equity entirely.
Verification
curl -sI https://example.com/old-urland check the status code andLocationheader.- Use Search Console’s URL inspection tool. It reports the redirect chain Google followed.
- Crawl the site to find chains and loops.
Related topics
Sources & further reading
- RFC 9110 - HTTP Semantics, redirection 3xx - IETF
- Redirects and Google Search - Google Search Central
- MDN - Redirections in HTTP - MDN