301 vs 302 vs 307 vs 308 Redirects

301 and 308 represent permanent redirects, while 302 and 307 are temporary; 307 and 308 explicitly preserve the request method and body.

How it works

Redirect codes describe a response's requested next location. Browser and intermediary behavior, caching, and application method handling make the exact code important beyond ordinary page navigation.

301 signals a permanent redirect and 302 a temporary one. In practice, historical client behavior around method changes makes 301 and 302 less precise for non-GET requests. 307 is temporary and explicitly preserves the request method and body; 308 is permanent and explicitly preserves them. 303 is useful context because it tells a client to follow with GET, commonly after a form submission.

A simple website migration may use a permanent redirect from http://example.com to https://example.com/. A temporary maintenance or testing route may use 302 or 307. An API endpoint receiving POST data should use a code whose method behavior matches the intended client interaction rather than copying a browser-navigation example.

Permanent and temporary responses can influence browser and intermediary caching, and search engines evaluate many signals beyond one response code. Avoid claims that one status automatically guarantees indexing, ranking, or cache behavior. Publish the code that expresses the real durability of the move, then keep canonical, internal-link, and server rules consistent.

Inspect a chain rather than reasoning from configuration names. Record the entered URL, every status, every Location target, and the final response. A one-hop redirect can be intentional; repeated moves between HTTP and HTTPS or www and apex often indicate conflicting layers and create latency or loops.

The headers checker observes a bounded public HEAD request with a limited GET fallback when appropriate. It does not send cookies, authenticate, or prove behavior for every method. For a method-sensitive flow, test safely with the real client and request method after using the public chain as a baseline.

What the codes communicate

301 communicates a permanent move and 302 a temporary redirect. 303 is often used after a form action to direct a follow-up GET. 307 is temporary and preserves method and body; 308 is permanent and preserves method and body. This distinction matters for POST and API traffic.

Search engines and caches may treat permanent and temporary signals differently, but no single status code guarantees an indexing or caching outcome. Choose the code that accurately represents the intended application behavior and test the resulting chain.

Inspect a redirect chain

Start with the entered URL, record each status and Location header, and confirm the final URL and response. A simple HTTP-to-HTTPS move may have one permanent hop. Extra hops between www, apex, locale, or application paths add latency and can obscure a loop.

Use a bounded public headers check to inspect the chain without cookies or authentication. For method-sensitive endpoints, test with the real client and method in a safe environment; a browser GET observation cannot prove how an API POST will be handled.

Practical guidance

Common question

Is 302 wrong? No. It is appropriate for many temporary flows; the intent and client behavior determine the correct response.

Try the relevant tool

Inspect a public URL's response statuses, Location headers, and bounded redirect chain.

Check HTTP headers and redirects