301·302·307·308 — redirect status codes

See the difference between 301, 302, 307 and 308 redirects as an animated request→response sequence. Permanent vs temporary and POST method preservation made visual.

Scenario

Speed
301 — PERMANENT307 — KEEP METHOD303 — GET AFTER POSTBrowserServer1GET /old-post2301 Moved PermanentlyLocation: /new-post301 is remembered as permanent by browsers, CDNs and search engines — they may skip the old URL next time. 302 is temporary, so they always re-check the original. SEO authority transfers with 301.4GET /new-post5200 OK6POST /submit7307 Temporary RedirectLocation: /new-submit301/302 conventionally turn a POST into a GET on retry, losing the body. If the method must survive, use 307 (temporary) / 308 (permanent) — the method-preserving pair for the same purposes.9POST /new-submit10200 OK11POST /contact-form12303 See OtherLocation: /thanksThe Post-Redirect-Get (PRG) pattern: after a form POST, a 303 to a GET page means refreshing never resubmits the form — the standard shape of a success screen.14GET /thanks15200 OK

Requests

6

Current step 15/15

200 OK

The result page answers normally.

Request2xx success3xx redirect/cache4xx client error5xx server error

Arrow color = status class. The key redirect pair: 301 is 'permanent', 307 'keeps the method'. Notice how cheap the second request is when the cache validates (304).

All status codes

1xx Informational

100Continue'Go ahead' before a large body — the answer to Expect: 100-continue
101Switching ProtocolsProtocol switch approved — WebSocket upgrade is the classic case
103Early HintsHeaders sent before the final response — for Link preload hints

2xx Success

200OKThe standard success response
201CreatedA new resource was created — successful POST/PUT
202AcceptedAccepted but not processed yet — async work queued
204No ContentSuccess with nothing to return — common after DELETE
206Partial ContentOnly part of the resource — Range requests, video seeking, resumed downloads

3xx Redirection

300Multiple ChoicesMultiple choices to pick from — rarely used today
301Moved PermanentlyPermanent move — remembered by browsers/search engines, SEO transfers▶ Animate
302FoundTemporary move — original URL keeps its index; POST becomes GET by convention▶ Animate
303See Other'Go GET a different URL' — the standard for redirecting after POST (PRG)▶ Animate
304Not ModifiedCache validation passed — 'use your copy', no body sent▶ Animate
305Use ProxydeprecatedForced proxy use — deprecated over security concerns
307Temporary RedirectTemporary move, method/body preserved — the precise 302▶ Animate
308Permanent RedirectPermanent move, method/body preserved — the precise 301▶ Animate

4xx Client error

400Bad RequestThe request itself is malformed — bad syntax, broken parameters
401UnauthorizedNot authenticated — credentials needed; WWW-Authenticate hints the scheme▶ Animate
402Payment RequiredPayment required — reserved, with almost no standard use
403ForbiddenAuthenticated but not allowed — retrying changes nothing▶ Animate
404Not FoundNot here right now — the most famous code▶ Animate
405Method Not AllowedRight URL, wrong method — the Allow header lists what works
406Not AcceptableCan't produce a format you Accept — content negotiation failed
407Proxy Authentication RequiredProxy authentication needed — corporate proxy environments
408Request TimeoutThe server timed out waiting for the request
409ConflictConflicts with current state — concurrent edits, version mismatch
410GoneExplicitly deleted forever — deindexes faster than 404▶ Animate
411Length RequiredContent-Length is required and missing
412Precondition FailedA precondition like If-Match didn't hold
413Content Too LargeRequest body too large — upload size limit
414URI Too LongRequest URI too long
415Unsupported Media TypeContent-Type not supported
416Range Not SatisfiableRequested Range falls outside the resource
417Expectation FailedCan't satisfy the Expect header
418I'm a teapot'I'm a teapot' — 1998 April Fools' joke; some sites reuse it for rate limiting
422Unprocessable ContentWell-formed but semantically wrong — the standard for validation failures
425Too EarlyReplay risk — rejects 0-RTT early data
426Upgrade RequiredProtocol upgrade required — Upgrade header says to what
428Precondition RequiredConditional requests required — forces If-Match against lost updates
429Too Many RequestsToo many requests — rate limiting; pairs with Retry-After
431Request Header Fields Too LargeRequest headers too large — bloated cookies are the usual cause
451Unavailable For Legal ReasonsBlocked for legal reasons — censorship, DMCA; named after Fahrenheit 451

5xx Server error

500Internal Server ErrorServer code error — the most common 5xx▶ Animate
501Not ImplementedNot implemented — the server doesn't support that method/feature
502Bad GatewayGateway couldn't reach the upstream — a middle-layer problem▶ Animate
503Service UnavailableTemporarily unavailable — overload or maintenance; pairs with Retry-After▶ Animate
504Gateway TimeoutUpstream didn't respond in time — slow queries, timeout misconfig
505HTTP Version Not SupportedThe requested HTTP version isn't supported
507Insufficient StorageServer out of storage — WebDAV
508Loop DetectedInfinite loop detected — WebDAV circular references
511Network Authentication RequiredNetwork auth required — captive portals (Wi-Fi login pages)

An HTTP redirect is the server answering 'not here — go there instead'. Instead of a page it returns a Location header with the new URL, and the browser re-issues the same request automatically. The user just sees the address bar change, but two full request-response round trips happened.

The four codes split along two axes. 301/308 mean 'permanent' — browsers, CDNs and search engines may remember it and skip the old URL next time, while 302/307 are 'temporary' so the original is always re-checked. Search ranking transfers through 301, which makes it the only correct choice for domain moves and URL migrations.

The other axis is method preservation. For historical reasons, 301/302 conventionally rewrite a POST into a GET on retry — the body is lost. 307/308 explicitly require the method and body to survive. If a form POST or API call may cross a redirect, use 307/308 or expect silent data loss. HTTP Status Playground

Frequently asked questions

What's the practical difference between 301 and 302?
Permanence. 301 tells browsers and search engines 'this URL is permanently that one' — it gets cached and SEO value transfers to the new URL. 302 is 'for now', so the original keeps its index entry. Accidentally using 302 for a permanent move leaves the old URL in search results.
Does a POST lose its data when redirected?
Through 301/302, yes — convention rewrites the POST into a GET and the body is dropped. This is the classic cause of login forms silently submitting empty requests. To preserve method and body, use 307 (temporary) or 308 (permanent).
When should I use 307 or 308?
As the method-preserving replacements for 302/301. 308 is 'permanent + keep method' — the precise 301. 307 is 'temporary + keep method' — the precise 302. For APIs, starting with 307/308 avoids the legacy POST→GET footgun entirely.

Other scenarios

Related tools