HTTP Redirect Status Codes (3xx)

Comprehensive guide to HTTP 3xx redirect codes: when to use 301 vs 302 vs 307 vs 308, SEO implications, and browser behavior.

  • JSON6,594 B
  • YAML4,921 B · −25%
  • TOON4,129 B · −37%

A guide to the 3xx redirection codes (300, 301, 302, 303, 304, 307 and 308) with when to use each, an example and notes, followed by best practices on redirect chains, caching and SEO.

Use it when

  • You are moving a URL and need the right redirect status.
  • You need to know whether the request method is preserved.

Watch out for

  • 301 and 308 are cached by browsers for a long time, so test before deploying a permanent redirect.
  • Redirect chains slow pages and can lose the original method or body.

The data

Redirect codes

CodeNameWhen to useExampleNotes
300Multiple ChoicesRequest has multiple possible responses; user or agent should choose one.Server can serve content in multiple formats/languages; returns list of options.Rarely used; most servers return 200 or 404 instead
301Moved PermanentlyResource has new permanent URL; update bookmarks/links; SEO link equity transfers.HTTP/1.1 301 Moved Permanently\nLocation: https://example.com/new-pathCached by browsers and search engines; GET/HEAD may change to GET; POST becomes GET (not guaranteed)
302Found (Temporary Redirect)Resource temporarily at different URI; keep original URL in future requests.HTTP/1.1 302 Found\nLocation: /login?next=/dashboardOriginal method may change to GET (historical); use 307 for method preservation
303See OtherRedirect after POST to GET (Post/Redirect/Get pattern); response to request is at different URI.After form submission: HTTP/1.1 303 See Other\nLocation: /thank-youAlways converts request to GET regardless of original method
304Not ModifiedConditional GET request; resource cached and unchanged; no body sent.Request: If-None-Match: "abc123"\nResponse: HTTP/1.1 304 Not ModifiedUses ETag or Last-Modified headers; saves bandwidth; browser uses cached copy
307Temporary Redirect (Strict)Temporary redirect preserving HTTP method and body (POST stays POST).HTTP/1.1 307 Temporary Redirect\nLocation: https://api.example.com/v2/endpointMust not change method; modern replacement for 302 when method preservation matters
308Permanent Redirect (Strict)Permanent redirect preserving HTTP method (POST→POST); SEO-safe permanent.HTTP/1.1 308 Permanent Redirect\nLocation: https://example.com/new-api-endpointLike 301 but method/body preserved; RFC 7538; widely supported in modern browsers

Best practices

  • Use 301 for permanent URL changes (site migration, HTTP→HTTPS upgrade)
  • Use 302 for temporary A/B tests, maintenance pages, short-term moves
  • Use 307 when you need to preserve POST data during temporary redirect
  • Use 308 for permanent API endpoint migration where method must stay same
  • Always include Location header with absolute URL for 301/302/307/308
  • Avoid redirect chains (max 1-2 hops); each redirect adds latency
  • Set Cache-Control headers appropriately: long max-age for 301, no-cache for 302
  • Test with curl -I to verify Location header and status code
  • For SEO: 301 passes PageRank; 302 does not (usually)
  • Never redirect POST to GET unless using 303 (Post/Redirect/Get pattern)

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
redirect_codescodeinteger300
redirect_codesnamestringMultiple Choices
redirect_codeswhen_to_usestringRequest has multiple possible responses; user o…
redirect_codesexamplestringServer can serve content in multiple formats/la…
redirect_codesnotesstringRarely used; most servers return 200 or 404 ins…
best_practices*array[10 items]

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.yunusemrevurgun.com/api/dataset/http-redirect-status-codes?format=toon"
const res = await fetch(
  "https://yjtoon.yunusemrevurgun.com/static-data/dataset/http-redirect-status-codes.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • http
  • redirects
  • 3xx
  • seo
  • permanent
  • temporary

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets