HTTP Redirect Codes: 301 vs 302 vs 307 vs 308

HTTP redirect codes compared: permanent vs temporary, method preservation, SEO link equity transfer, and when to use 301, 302, 307, or 308.

ZERO UPLOAD · ALL LOCAL
  1. Type a code number (e.g. 404) to find codes by number only, or a word (e.g. "timeout", "rate limit") to search names and detail content.
  2. Use the category pills (1xx–5xx) to browse codes by class when not searching.
  3. Click Details on any card to expand causes and resolution steps in a full-width panel below the row.
  4. Click Copy Markdown on an expanded card to copy a ready-to-paste summary for Jira tickets, GitHub issues, or Slack.

Redirect codes compared

  • 301 Moved Permanently cached indefinitely, allows POST to downgrade to GET
  • 302 Found temporary, not cached, allows POST to downgrade to GET
  • 308 Permanent Redirect method-preserving counterpart of 301
  • 307 Temporary Redirect method-preserving counterpart of 302

1XX INFORMATIONAL — 4 codes

100 Continue
RFC 9110
101 Switching Protocols
RFC 9110
102 Processing
RFC 2518
103 Early Hints
RFC 8297

2XX SUCCESS — 10 codes

200 OK
RFC 9110
201 Created
RFC 9110
202 Accepted
RFC 9110
203 Non-Authoritative Information
RFC 9110
204 No Content
RFC 9110
205 Reset Content
RFC 9110
206 Partial Content
RFC 9110
207 Multi-Status
RFC 4918
208 Already Reported
RFC 5842
226 IM Used
RFC 3229

3XX REDIRECTION — 8 codes

300 Multiple Choices
RFC 9110
301 Moved Permanently
RFC 9110
302 Found
RFC 9110
303 See Other
RFC 9110
304 Not Modified
RFC 9110
305 Use Proxy
RFC 9110
307 Temporary Redirect
RFC 9110
308 Permanent Redirect
RFC 9110

4XX CLIENT ERROR — 35 codes

400 Bad Request
RFC 9110
401 Unauthorized
RFC 9110
402 Payment Required
RFC 9110
403 Forbidden
RFC 9110
404 Not Found
RFC 9110
405 Method Not Allowed
RFC 9110
406 Not Acceptable
RFC 9110
407 Proxy Authentication Required
RFC 9110
408 Request Timeout
RFC 9110
409 Conflict
RFC 9110
410 Gone
RFC 9110
411 Length Required
RFC 9110
412 Precondition Failed
RFC 9110
413 Content Too Large
RFC 9110
414 URI Too Long
RFC 9110
415 Unsupported Media Type
RFC 9110
416 Range Not Satisfiable
RFC 9110
417 Expectation Failed
RFC 9110
418 I'm a Teapot (Unofficial)
RFC 2324
420 Enhance Your Calm (Unofficial)
Twitter
421 Misdirected Request
RFC 9110
422 Unprocessable Content
RFC 9110
423 Locked
RFC 4918
424 Failed Dependency
RFC 4918
425 Too Early
RFC 8470
426 Upgrade Required
RFC 9110
428 Precondition Required
RFC 6585
429 Too Many Requests
RFC 6585
431 Request Header Fields Too Large
RFC 6585
444 No Response (Unofficial)
nginx
451 Unavailable For Legal Reasons
RFC 7725
494 Request Header Too Large (Unofficial)
nginx
495 SSL Certificate Error (Unofficial)
nginx
496 SSL Certificate Required (Unofficial)
nginx
499 Client Closed Request (Unofficial)
nginx

5XX SERVER ERROR — 19 codes

500 Internal Server Error
RFC 9110
501 Not Implemented
RFC 9110
502 Bad Gateway
RFC 9110
503 Service Unavailable
RFC 9110
504 Gateway Timeout
RFC 9110
505 HTTP Version Not Supported
RFC 9110
506 Variant Also Negotiates
RFC 2295
507 Insufficient Storage
RFC 4918
508 Loop Detected
RFC 5842
510 Not Extended
RFC 2774
511 Network Authentication Required
RFC 6585
520 Web Server Returns an Unknown Error (Unofficial)
Cloudflare
521 Web Server Is Down (Unofficial)
Cloudflare
522 Connection Timed Out (Unofficial)
Cloudflare
523 Origin Is Unreachable (Unofficial)
Cloudflare
524 A Timeout Occurred (Unofficial)
Cloudflare
525 SSL Handshake Failed (Unofficial)
Cloudflare
526 Invalid SSL Certificate (Unofficial)
Cloudflare
527 Railgun Listener to Origin Error (Unofficial)
Cloudflare
No codes match your search.

HTTP Redirect Codes: 301 vs 302 vs 307 vs 308

HTTP redirect codes tell the browser or crawler where to go next. The 3xx class signals that the client must take an additional step to complete the request: follow the Location header to a new URI. Four codes dominate practical use: 301, 302, 307, and 308. Choosing the wrong one has lasting consequences for SEO, client behaviour, and HTTP method semantics. A 301 is intended to be cached indefinitely by browsers and CDNs: using it for a temporary redirect can leave clients stuck at the old URL for weeks. Furthermore, 301 and 302 allow clients to downgrade POST to GET on the redirect, while 307 and 308 require the client to repeat the same method.1 Understanding these distinctions prevents subtle bugs in form submissions, API redirects, and site migrations.

Permanent vs temporary semantics

The permanent vs temporary distinction determines caching behaviour and crawl frequency. A 301 Moved Permanently tells the client the resource has moved and the change is definitive: browsers cache the redirect and stop checking the original URL, and search engines transfer link equity to the new URL.2 A 302 Found tells the client the resource is temporarily at a different location: browsers do not cache the redirect, and search engines keep the original URL indexed.

Temporary redirects during A/B tests and promotions

Using 301 for a redirect you plan to reverse causes browsers to serve the old destination from cache for weeks after you change the route. 308 Permanent Redirect is the method-preserving counterpart of 301, and 307 Temporary Redirect is the method-preserving counterpart of 302. When migrating a site permanently, use 301 or 308; for temporary changes, use 302 or 307. The cost of choosing incorrectly is not theoretical: during a promotional campaign, a cached 301 can direct users to a defunct landing page long after the campaign ends, while a 302 ensures each visitor checks the current routing and receives the up-to-date destination.

Method preservation: 307 and 308 vs 301 and 302

The key difference between the older and newer redirect codes is how they handle the HTTP method of the original request. A 301 Moved Permanently and a 302 Found both allow clients to change a POST to a GET when following the redirect, and most browsers do exactly this without prompting the user. A 307 Temporary Redirect and a 308 Permanent Redirect require the client to repeat the same HTTP method on the new URL: a POST stays a POST, a PUT stays a PUT, and a PATCH stays a PATCH.1

Why method preservation matters

This distinction matters whenever the original request carries a body. A form submission via POST that receives a 301 redirect will be retried as a GET, losing the form body and silently corrupting the user's input. A 307 forces the browser to resend the POST to the new URL, preserving the body and ensuring the application receives the data the user originally submitted.

When a redirect must repeat the original method instead of downgrading POST to GET, preserving the request body across a 307 or 308 is the reason these two codes exist. 307 is the correct code for redirecting API endpoints that receive POST or PUT requests, because clients that follow the redirect should not silently change the method and lose the request body. The same applies to 308 for permanent redirects of stateful endpoints: choosing 301 over 308 in this scenario introduces a subtle bug that only manifests when a client submits a form or uploads a file, making it particularly hard to catch in development environments that primarily exercise GET requests.

SEO and link equity transfer

Search engine treatment of redirect codes affects how link equity passes between URLs, how quickly old URLs are deindexed, and whether the new URL is indexed at full ranking strength. A 301 redirect passes link equity to the new URL and is treated by Google as a permanent change: after several crawl cycles, the new URL replaces the old one in the index. A 302 redirect is treated as temporary and Google continues to index the original URL.2

A site migration from HTTP to HTTPS should use 301 or 308 redirects, not 302, to transfer ranking signals to the HTTPS URLs. Redirect chains (A to B to C) dilute link equity with each hop and add a round trip per hop that delays page rendering.3 Flattening redirect chains to direct A-to-C redirects preserves more equity and speeds up crawler processing. Keeping redirect chains longer than two hops is a common technical SEO debt that accumulates during site restructuring.

HSTS and permanent redirects for HTTPS enforcement

HTTP Strict Transport Security (HSTS) instructs browsers to use HTTPS exclusively for a domain after the first successful HTTPS response.4 Once a browser processes an HSTS header, it refuses to make HTTP requests to that domain and converts them to HTTPS internally, even before receiving a redirect. Combining a 301 or 308 redirect from HTTP to HTTPS with an HSTS header on the HTTPS response creates a layered enforcement strategy: the redirect handles the first visit, and HSTS handles all subsequent visits without a round trip.

The Strict-Transport-Security: max-age=31536000; includeSubDomains; preload header on your HTTPS responses opts the domain into HSTS preload lists maintained by browsers. Once your domain is on the preload list, browsers ship with your domain hardcoded as HTTPS-only, eliminating the initial HTTP-to-HTTPS redirect entirely for all users.4 Preloading is irreversible without a delisting process that takes months: only preload when you are certain all subdomains can serve HTTPS permanently.

307 versus 308 for method-preserving HTTPS redirects

For the initial HTTP-to-HTTPS redirect, use 308 Permanent Redirect rather than 301 when any routes on your site accept POST requests over HTTP. A 301 from HTTP to HTTPS allows clients to downgrade POST to GET on the redirect, losing the request body. A 308 preserves the POST method, ensuring the HTTPS version of the endpoint receives the complete request. Most HTTP-to-HTTPS redirects serve browser GET requests where method preservation does not matter, but APIs that accept HTTP POST from legacy clients need 308 to avoid silent data loss.

When to use this

Use this guide when choosing a redirect code for a site migration, an HTTPS upgrade, a URL restructuring, or an API endpoint change. Reference it to determine whether method preservation and permanent vs temporary semantics affect your use case.

Examples

Migrating a site from HTTP to HTTPS

Use 308 Permanent Redirect from http:// to https://, not 301. 308 preserves the HTTP method (important if any POST requests arrive on HTTP), and the permanent semantics transfer SEO link equity to the HTTPS URLs.

Temporary promotional landing page redirect

Use 302 Found. The redirect is temporary and you will revert it after the promotion. 302 prevents browsers from caching the redirect, ensuring all requests check the current routing after the promotion ends.

Redirecting an API endpoint that receives POST requests

Use 307 Temporary Redirect. This forces clients to repeat the POST to the new URL rather than downgrading to a GET, which would lose the request body. Use 308 if the redirect is permanent.

Sources
  1. 1.

    R. Fielding, Ed., M. Nottingham, Ed., and J. Reschke, Ed., "HTTP Semantics," RFC 9110, IETF, June 2022. https://www.rfc-editor.org/rfc/rfc9110

  2. 2.

    Mozilla Developer Network, "Strict-Transport-Security header," developer.mozilla.org, accessed June 2026. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security

  3. 3.

    Google Search Central, "Redirects and Google Search," developers.google.com, accessed June 2026. https://developers.google.com/search/docs/crawling-indexing/301-redirects

  4. 4.

    Google PageSpeed Insights, "Avoid Landing Page Redirects," developers.google.com, accessed June 2026. https://developers.google.com/speed/docs/insights/AvoidRedirects

FAQ