3xx Redirect HTTP Status Codes
3xx responses indicate that the client must take additional action to complete the request. Most commonly, this means following a redirect to a new URL, but 304 handles cache validation and 300 handles content negotiation.
All 3xx Codes
| Code | Name | Summary | Guide |
|---|---|---|---|
| 300 | Multiple Choices | Multiple representations available; client or server picks one. | Guide |
| 301 | Moved Permanently | URL has permanently moved. Update bookmarks and links. SEO: transfers ranking. | Guide |
| 302 | Found | Temporary redirect. Browsers may change POST to GET when following. | Guide |
| 303 | See Other | Always redirects to a GET. Used for Post/Redirect/Get pattern. | Guide |
| 304 | Not Modified | Conditional GET: resource unchanged, use cached copy. | Guide |
| 305 | Use Proxy | Deprecated. Previously directed clients to use a specific proxy. | Guide |
| 306 | Unused | Reserved. Was “Switch Proxy” in early HTTP/1.1 drafts; never standardized. | Guide |
| 307 | Temporary Redirect | Temporary redirect that preserves HTTP method. POST stays POST. | Guide |
| 308 | Permanent Redirect | Permanent redirect that preserves HTTP method. POST stays POST. | Guide |
The Four-Way Redirect Decision Matrix
Choosing the right redirect code requires answering two questions: (1) is this redirect permanent or temporary, and (2) should the HTTP method be preserved? The answers give you four codes:
| Method may change (POST → GET) | Method preserved (POST stays POST) | |
|---|---|---|
| Temporary | 302 Found | 307 Temporary Redirect |
| Permanent | 301 Moved Permanently | 308 Permanent Redirect |
In practice, most web applications only need two of these: 301 for permanent URL changes on websites (where method preservation does not matter because they are always GET), and 307 for API redirects where a POST or PUT must reach the new URL intact.
Permanent vs. Temporary: SEO and Caching Implications
Permanent redirects (301 and 308) have lasting effects. Browsers cache permanent redirects, meaning the same browser will follow the redirect without hitting your server again until the cache expires. Search engines treat permanent redirects as a signal to transfer ranking and indexing from the old URL to the new URL. Google typically processes 301 redirects within a few weeks, consolidating PageRank at the destination URL.
Temporary redirects (302, 303, and 307) have no permanent effect. Browsers do not cache them (without explicit Cache-Control headers). Search engines keep the original URL in their index. Use temporary redirects for: maintenance pages, A/B testing landing pages, authentication redirects (login → dashboard), and any redirect that might be reversed.
A common mistake: using 301 for a redirect that turns out to need reverting. Once a 301 is cached by a browser, it can persist for the cache’s default TTL (often minutes to hours) even after the redirect is removed. Use 302 during development and only switch to 301 when you are certain the redirect is permanent.
Post/Redirect/Get: Why 303 Exists
303 See Other exists specifically for the Post/Redirect/Get (PRG) pattern. When a user submits a form (POST), the server processes it and redirects the browser to a result page (GET). This prevents the “Are you sure you want to resubmit?” dialog that browsers show when refreshing a page reached via POST.
303 always converts the method to GET, making it the safest choice for form submission redirects. Rails 7.1 returns 303 by default after a successful form submission. Express.js requires explicit res.redirect(303, url). Django returns 302 by default from HttpResponseRedirect but 303 can be specified explicitly.
The difference from 302: 302 is specified to convert POST to GET, but this behavior is technically not guaranteed by the spec (it is historical browser behavior). 303 explicitly and always redirects to a GET. Use 303 when you want formal compliance with the spec for PRG redirects.
304 Not Modified: Cache Validation
304 Not Modified does not redirect the client anywhere. It tells the client to use its cached copy of the resource because the resource has not changed. Clients trigger 304 responses by including If-None-Match (with an ETag) or If-Modified-Since (with a timestamp) in their request headers.
304 is crucial for web performance. Instead of re-sending a 50 KB JavaScript file that the browser already has in its cache, the server sends a 200-byte 304 response confirming the cached copy is still valid. The bandwidth and time savings at scale are significant. CDNs and browser caches both participate in 304 revalidation.
Redirect Chains and Performance
A redirect chain occurs when one redirect leads to another: URL A → 301 → URL B → 301 → URL C. Each redirect adds a round-trip. More than two hops in a chain cause measurable performance degradation and may cause search engine crawlers to stop following.
Common sources of redirect chains: HTTP → HTTPS redirect followed by a non-www → www redirect (combine into one); old domain → new domain with intermediate redirects; legacy URL pattern → slugified URL → canonical URL. Audit your redirects with tools like curl’s -L flag or browser dev tools to detect chains and consolidate them.