301 vs 302 Redirects: Which to Use, and When
301 vs 302: a 301 is permanent and a 302 temporary. How the five redirect codes differ for SEO, with Apache, Nginx and Caddy config.

Use a 301 when a URL has moved for good and a 302 when it is only temporarily elsewhere. Search engines read a 301 as a strong signal to index the new address and a 302 as a signal to keep the old one.
Every redirect answers one question for the browser: where should I go instead? The status code answers a second question that matters just as much: is this change for good, or only for now? Get that second answer wrong and nothing breaks on screen, which is exactly why the mistake survives for years. Search engines keep the wrong URL indexed, browsers cache a rule you meant to remove, or a form submission quietly loses its data.
This guide compares the five redirect codes you will meet (301, 302, 303, 307 and 308), shows what each one does to the request with a test we ran in curl and Chromium, quotes how Google documents each code, covers the two redirects that are not status codes at all, gives working configuration for Apache, Nginx and Caddy, lists the default code in the places most redirects actually live (a CDN rule, a plugin, a hosting panel), and answers the questions clients ask us most often.
The short answer
- Moved for good: use 301, or 308 if the URL receives form posts or API calls that must keep their method.
- Temporarily elsewhere: use 302, or 307 if the method and body must survive.
- After a form submission, send the visitor to a result page: use 303.
The rest of this page explains why, and where the common mistakes hide.
The five codes side by side
| Code | Name | Meaning | Method after redirect | Search engine signal |
|---|---|---|---|---|
| 301 | Moved Permanently | The resource has a new permanent URL | Browsers change POST to GET | Strong: index the target |
| 302 | Found | The resource is temporarily at another URL | Browsers change POST to GET | Weak: usually keep the original |
| 303 | See Other | Go and GET a different resource | Always GET | Weak, treated as temporary |
| 307 | Temporary Redirect | Temporarily elsewhere, same request | Method and body kept | Weak, treated as temporary |
| 308 | Permanent Redirect | Moved for good, same request | Method and body kept | Strong: index the target |
The definitions come from RFC 9110, the current HTTP specification. The search engine column follows Google's own documentation on redirects and Google Search, which groups 301 and 308 as permanent and 302, 303 and 307 as temporary.
What happens to the method and the body
The original HTTP specification said a 301 or 302 should repeat the same request at the new URL. Browsers did not do that for POST requests: they switched to GET and dropped the body, and the behaviour stuck. RFC 9110 now records it, saying that for historical reasons a user agent may change POST to GET after a 301 or 302. Codes 307 and 308 were added precisely so a server could say "same request, new address" and be sure the method would survive.
We checked this rather than repeating it. A small test server returned each status code and pointed at a page that printed the method and body it received. We then sent a form POST containing name=Asha from curl (with -L) and from a real Chromium browser.
The result matches the specification in both clients: after 301, 302 and 303 the target received a GET with no body; after 307 and 308 it received the original POST with the data intact.
Why this matters in practice:
- Moving an API endpoint. If a mobile app or a partner integration POSTs to
/api/v1/ordersand you 301 it to/api/v2/orders, the new endpoint receives a GET with no order in it. Use 308. - Forcing HTTPS on a form endpoint. A form that posts to an http URL and is redirected with 301 loses its data at the https URL. The real fix is to post to https in the first place; 308 is the safe redirect if old clients still call the http address.
- After a successful form submission. Sending the browser on to a "thank you" page with 303 is the intended use: the result page is fetched with GET, so a refresh does not resubmit the form.
What search engines do with each code
Google treats a permanent redirect (301 or 308) as a strong signal that the target URL should become the canonical one: the new URL is indexed and ranking signals consolidate onto it. A temporary redirect (302, 303 or 307) is a weak signal: Google follows it, but usually keeps showing the original URL, on the assumption that the move will be undone.
That leads to the most common SEO mistake with redirects: moving a page for good with a 302. The old URL can stay in the index for a long time, while the new one is treated as a temporary stand in. Google may eventually decide a long running 302 is really permanent, but that is a guess you have left to a crawler instead of a decision you made.
The reverse mistake costs you too. A 301 used for something temporary, such as a seasonal sale page, tells Google to replace the original URL with the sale page. When the sale ends and you remove the redirect, the original has to earn its place back.
Google's handling, code by code
Google documents the treatment of each code in how HTTP status codes affect Google Search:
- 301 is followed, and is a strong signal that the redirect target should become the canonical URL.
- 302 is followed, and is a weak signal for the target.
- 303 is handled the same way as a 302.
- 307 is described as equivalent to a 302.
- 308 is described as equivalent to a 301.
- 304 Not Modified is not a redirect at all. It tells the crawler that the content is the same as the last crawl, and it has no effect on indexing.
Two useful conclusions follow. First, 307 and 308 cost you nothing in search terms: if a client needs its method preserved, the search signal is identical to the 302 or 301 you would otherwise have sent, so there is no reason to accept a broken POST for the sake of a familiar code. Second, Google reads the same meaning out of codes that mean different things in HTTP, and the same documentation notes that these codes remain semantically different. A payment callback does not care what Google thinks of your redirect; it cares whether its POST body survived the hop.
One more detail from that page is easy to trip over while you debug: Google Inspection Tools do not follow redirects. Running the URL Inspection tool on an old URL therefore tells you about that old URL, not about the destination. Inspect the final URL when you want to know whether the new page is indexed.
Does a 302 pass link signals?
This is where most comparisons overreach. The claim you will read repeatedly is that a 301 passes link equity while a 302 passes none at all, sometimes with a percentage attached. Google's documentation does not say that. It describes the difference as the strength of a canonicalization signal: a permanent redirect is a strong signal that the target should be the indexed URL, and with a temporary redirect the redirecting URL generally stays the indexed one, while the target may still be indexed if other canonicalization signals point at it.
So the real argument is about which URL gets indexed, not about a share of authority evaporating at each hop. That matters for how you spend your time:
- Send the code that states your actual decision. A permanent code makes the decision; a temporary code leaves it to a crawler.
- Point the redirect at the closest equivalent page, which is the part that genuinely affects how the target is assessed.
- Keep the rule in place long enough for the change to be processed.
Percentages for "link equity lost in a 301" come from third parties, not from Google, and there is no way to measure them on your own site. Treat the code as a statement of intent that you control, and ignore the arithmetic.
Browsers cache permanent redirects
RFC 9111 lets caches store 301 and 308 responses even without explicit caching headers, and browsers do. A visitor who received your 301 once may keep following it from their own cache long after you removed the rule from the server. That is the main reason to be certain before you send a 301, and the reason to test with the cache disabled. Temporary codes are not cached unless you send headers that allow it.
How long to keep a redirect in place
Google's site move documentation answers this in one line: "Keep the redirects for as long as possible, generally at least 1 year." The same page explains why the floor is that high. For a medium sized site it can take a few weeks or more before Google starts showing the new URLs instead of the old ones, larger sites take longer, and the move is not complete until Googlebot has visited every URL on both the old and the new site at least once.
Our own practice is to treat a redirect as permanent infrastructure rather than a migration task with an end date. One year is the minimum, there is no benefit in removing a rule that works, and visitors keep arriving on old URLs from bookmarks, old emails, PDFs, printed material and links on other sites for years. Keep the URL map in version control so the next migration can point old URLs straight at the newest destination instead of chaining through this one.
Redirects that are not status codes
A redirect does not have to be a status code, and the alternatives are read differently.
meta refresh. A tag in the HTML head, or the equivalent Refresh HTTP header, that sends the browser elsewhere after a delay. Google interprets an instant refresh (zero seconds) as a permanent redirect and a delayed one as temporary.
<!-- Instant: read as a permanent redirect -->
<meta http-equiv="refresh" content="0; url=https://www.example.com/pricing">
<!-- Delayed: read as a temporary redirect -->
<meta http-equiv="refresh" content="5; url=https://www.example.com/pricing">A JavaScript location change. Google does render JavaScript, so window.location.href = "/pricing" can work, but the documentation puts it last: use it only when a server-side redirect and a meta refresh are both impossible. The redirect exists only if rendering succeeds, and rendering is the step most likely to fail.
Two limits apply to both. Neither preserves a POST: the browser issues a fresh GET of the new URL, so neither is ever a substitute for a 307 or 308 on an endpoint that receives data. And neither works for anything that is not an HTML page, which rules them out for a PDF, an image or an API route.
The order of preference in Google's documentation is the same order a browser experiences: the status code arrives in the response headers before any body is parsed, a meta refresh needs the HTML, and a JavaScript redirect needs the page to execute. Prefer the status code whenever you have access to the server, a CDN rule or a hosting panel, which in practice is almost always.
When to use which
| Situation | Code | Why |
|---|---|---|
| Page or site moved to a new URL for good | 301 | Moves rankings to the new URL; works in every client |
| HTTP to HTTPS, apex to www | 301 or 308 | Permanent; 308 also keeps POSTs intact |
| API endpoint moved | 308 | Clients keep their method and body |
| Maintenance page for an hour | 302 or 307 | The original URL should stay indexed |
| A/B test splitting traffic to a variant URL | 302 | Temporary by design, and Google recommends a temporary redirect for this |
| Sending signed out visitors to the login page | 302 or 303 | The protected URL is not moving anywhere |
| After a form POST, show the result page | 303 | Forces GET so a refresh does not resubmit |
| Country or language selection | 302 | Different visitors need different targets |
Google's guidance on website testing is specific about A/B tests: use a 302, not a 301, and add a canonical tag on the variant pointing at the original.
When not to redirect at all
Three situations call for something other than a redirect, and all three are common enough to check for before you write a single rule.
The page is gone and has nothing to replace it. Google's site move documentation is explicit that old URLs with no new destination should correctly return an HTTP 404 or 410. A missing page that honestly says so costs you nothing; a redirect to an unrelated page wastes a visitor's click and tells a crawler something untrue.
The destination is irrelevant to the old page. The same documentation says not to redirect many old URLs to one irrelevant single destination, such as the home page of the new site, and warns that doing so can confuse users and might be treated as a soft 404 error. Mass redirecting a retired catalogue to the home page is the usual version of this. Map each old URL to its closest equivalent instead, and where you have genuinely merged several pages into one, redirecting all of them to that consolidated page is fine.
Both URLs have to stay reachable. A campaign URL with tracking parameters, a variant visitors have bookmarked and a print view all have to keep working, so a redirect is the wrong tool. Use a rel="canonical" link. Google's canonicalization documentation lists a redirect and a canonical link as comparably strong signals, but reserves the redirect for the case where you are deprecating the duplicate page outright.
A real chain that uses three codes
Codes mix in the wild. Here is the real chain for http://microsoft.com, traced with the Redirect Checker from our server in Europe on 28 October 2026:
The bare http address gets a 307 to https on the same host, then a 301 to the www host, then a 302 to a regional homepage chosen from where the request came from. Each choice fits its job: the region step is a 302 because a visitor from another country should land somewhere else, and the host step is a 301 because it never changes. Traced from India the same day, the chain stopped at https://www.microsoft.com/ with a 200 and no regional hop, which is the 302 doing exactly what it should: it only fires for some visitors.
To see the status of each hop on your own site, paste a URL into the Redirect Checker. For the full set of response headers on any one hop, including Location and any Cache-Control sent with the redirect, use the HTTP Header Checker. For a step by step method to trace chains with curl and Chrome DevTools as well, see how to check a redirect chain.
Reading the code in one command
If you prefer a terminal, one command prints the status line and the Location header without downloading the page. Here is this very URL, traced on 13 November 2026:
$ curl -s -o /dev/null -D - http://bitssolved.com/blog/301-vs-302-redirects.html
HTTP/1.1 301 Moved Permanently
Location: https://www.bitssolved.com/blog/301-vs-302-redirects.html
Server: Caddy
Date: Fri, 13 Nov 2026 08:42:39 GMT
Content-Length: 0Three things are worth reading out of five lines. The code is stated, so there is no guessing about permanence. The chain is one hop: the bare http apex goes straight to the final https www URL rather than passing through https://bitssolved.com on the way, which is what the next section asks for. And the 301 carries no Cache-Control header, so a cache is free to store it under its own heuristics, exactly as described above.
Add -L to follow the chain to its end and -A "Mozilla/5.0" if you suspect the server treats the default curl user agent differently. Note that the shorter curl -sI form sends a HEAD request, and a few servers answer HEAD differently from GET, so when a browser and curl disagree, repeat the trace with the GET form above.
Chains, hops and the final destination
Google's crawlers follow up to 10 redirect hops by default, which is a limit rather than a budget to spend. The site move documentation advises redirecting to the final destination directly, and where that is impossible, keeping the chain to "ideally no more than 3 and fewer than 5" hops, because every hop adds latency for a real visitor.
Chains accumulate by accident rather than by design. An http to https rule, an apex to www rule and an old URL to new URL rule get added at different times by different people in different places, and a visitor on an old link pays for all three round trips. What to do about it:
- Point the first rule at the final URL. The trace above does that: one hop from the bare http apex to the final https www address, not two.
- When a page moves twice, update the original rule. Repoint the first redirect at the newest URL instead of letting it chain through the middle one, which is why the URL map is worth keeping.
- Update your internal links. Google recommends updating as many links as possible to improve the experience and reduce server load. A redirect is not a substitute for a correct link in your own navigation, sitemap or email templates.
- Look for mixed codes. A 301 that lands on a URL which itself 302s somewhere else states no permanent destination at all, so the signal cancels out.
- Read Search Console as well as your own traces. The Page Indexing report marks a redirecting URL as "Page with redirect", and the documentation notes that the target may or may not be indexed depending on what Google makes of that target. Because the inspection tools do not follow redirects, check the destination URL separately.
Server configuration
Each snippet below states the code explicitly. That habit alone prevents most of the mistakes in this article, because several servers default to 302 when you leave the code out.
Apache
# One page moved for good
Redirect 301 /old-pricing /pricing
# A whole folder moved, keeping the rest of the path
RedirectMatch 301 ^/blog/2019/(.*)$ /articles/$1
# HTTP to HTTPS and apex to www in one hop (port 80 vhost)
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect 301 / https://www.example.com/
</VirtualHost>
# Temporary maintenance redirect with mod_rewrite
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^ /maintenance.html [R=302,L]A plain Redirect /old /new with no code sends a 302. Apache's mod_alias documentation lists the default as temp.
Nginx
# HTTP to HTTPS and apex to www in one hop
server {
listen 80;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}
# One page moved for good
location = /old-pricing {
return 301 /pricing;
}
# API endpoint moved, method and body preserved
location ~ ^/api/v1/(.*)$ {
return 308 /api/v2/$1$is_args$args;
}
# rewrite: 'permanent' gives 301, 'redirect' gives 302
rewrite ^/blog/2019/(.*)$ /articles/$1 permanent;Prefer return over rewrite for plain redirects; it is clearer and the code is impossible to miss. Note that a rewrite whose replacement starts with http:// or https:// redirects with 302 unless you add permanent.
Caddy
# Caddy redirects HTTP to HTTPS on its own, with a 308.
www.example.com {
redir /old-pricing /pricing permanent
@v1 path_regexp v1 ^/api/v1/(.*)$
redir @v1 /api/v2/{re.v1.1}?{query} 308
}
# Apex to www
example.com {
redir https://www.example.com{uri} permanent
}In Caddy, redir with no code sends a 302; permanent sends 301, and you can give a number such as 307 or 308 instead (Caddy redir documentation). Its automatic HTTP to HTTPS redirect is permanent already, so you do not need a rule for that.
Where the code is set when you never touch a server file
On most small sites no redirect lives in an Apache or Nginx file. The rules are in a CDN dashboard, a plugin or a hosting panel, written by whoever was closest to the problem that week. Each of those places has its own default, and the defaults disagree:
| Where the rule lives | Code with no choice made | How to set another code |
|---|---|---|
| Cloudflare redirect rule (Single Redirects) | 301 | Status code list offers 301, 302, 307 and 308 |
| Cloudflare Bulk Redirects | 301 | Same four codes, per redirect in the list |
Cloudflare Pages _redirects | 302 | Third field on the line: /old /new 301 |
| cPanel Redirects | Chosen in a Type menu | Permanent (301) or Temporary (302) |
wp_redirect() in WordPress code | 302 | Second argument: wp_redirect($url, 301) |
| A WordPress redirect plugin | Varies by plugin | Open each rule and read its HTTP code field |
| Shopify URL redirects | Permanent, no code option | Not applicable |
Apache Redirect with no code | 302 | Write Redirect 301 ... |
Nginx rewrite with no flag | 302 | Add permanent, or use return 301 |
Caddy redir with no code | 302 | Add permanent or a number |
Two patterns in that table explain a lot of misfiled redirects. A permanent move set up in a Cloudflare rule is right by default and a permanent move written with wp_redirect() is wrong by default, so the same migration done by two people in two places produces two different codes. And the rules can stack: a Cloudflare redirect rule runs at the edge before the request ever reaches the origin, so a 301 in your server config is invisible if a 302 at the CDN answers first. When a code on the live site disagrees with every file you can find, look at the layer in front of the server before you doubt the trace.
The temporary redirect that became permanent
Here is how it usually happens. During a migration someone adds a quick redirect in a hosting panel, a plugin or a .htaccess file. The panel default is 302, or the line is Redirect /old /new with no code. Everything works in the browser, so nobody looks again. A year later the old URLs are still in Google's index, the new pages rank below where the old ones did, and the redirect is still marked temporary.
How to catch it:
- List the URLs that moved: old pages, old domains, the http and non-www variants.
- Trace each one in the Redirect Checker and read the status column. Anything that will never move back should be 301 or 308.
- Look for chains in the same pass. A 301 that points at a URL which itself 302s somewhere else sends a mixed signal; point the first rule straight at the final URL.
- Fix the rule at its source. Search for every place a redirect can live: the CDN, the server config,
.htaccess, the CMS and any redirect plugin. - Trace again, with the browser cache disabled if you test in a browser.
The opposite trap is a 301 you now need to undo. Because browsers cache it, removing it from the server is not enough for people who already followed it. The usual remedy is to redirect the target back to the original URL as well, so cached visitors bounce home, and accept that some clients will take a while to forget.
Questions we get asked
Is a 302 bad for SEO?
No, when the move really is temporary. A maintenance page, a login redirect or an A/B test should be a 302, and Google follows it without complaint. A 302 only becomes a problem when it describes a move that is never going to be reversed, because then it asks a crawler to keep an abandoned URL in the index.
Will a 301 move my rankings to the new URL?
A permanent redirect is the strongest statement you can make that the target should be the canonical URL, and Google consolidates signals onto it. It is not instant and it is not a guarantee: the new page still has to be a reasonable equivalent of the old one. A permanent code pointed at an unrelated page is the case Google warns may be treated as a soft 404.
How long does Google take to show the new URL?
Weeks rather than days. Google's site move documentation says a medium sized site can take a few weeks or more before the new URLs appear instead of the old ones, and that the move is only complete once Googlebot has crawled every URL on both sites at least once. Larger sites take longer.
Should I use 301 or 308?
For a search engine it makes no difference: Google documents 308 as equivalent to 301. Choose 308 when any client might send a POST, PUT or DELETE to the old URL, because 308 requires the method and body to be preserved and 301 does not. Choose 301 when the URL only ever receives GET requests from browsers, where it is the better understood option in old clients.
Can I undo a 301 later?
Partly. You can remove the rule from the server at any time, but a browser that already cached the response may keep redirecting on its own for a long time, because permanent codes are cacheable even without caching headers. The practical workaround is to redirect the target back to the original URL so cached visitors end up in the right place. This is the reason to be sure before sending a permanent code, and the reason a long running experiment belongs on a 302.
Do redirects slow my site down?
Each hop is an extra round trip before any content arrives, so one is cheap and three are noticeable on a mobile connection. Google follows up to 10 hops and advises keeping chains to no more than three, ideally pointing the first rule straight at the final URL. The cost is paid by every visitor on every old link, which is why updating your own internal links matters more than the chain length itself.
Should I redirect or add a canonical tag?
Redirect when the old URL should stop serving content. Use a rel="canonical" link when both URLs have to keep working, for example a tracked campaign URL, a print view or a variant people have bookmarked. Google's canonicalization documentation treats both as strong signals but reserves the redirect for deprecating the duplicate.
What should I do with pages that have no replacement?
Let them return 404, or 410 if you want to state that the removal is deliberate. Google's own guidance for a site move is to make sure such URLs correctly return a 404 or 410 rather than redirecting them somewhere irrelevant. A tidy 404 page with a search box and a few links to your main sections is a better answer than a redirect to the home page.
If a site move is the reason you are reading this, how to move a website without losing search traffic covers the redirect map in detail. If changing a code produced a loop instead, redirect loop errors explains the usual causes. And when the rules are spread across a CDN, a server and a plugin so that nobody is sure which one answers, our website fixes service traces them, fixes them at a fixed price and runs the checks again to prove it.
Tools mentioned in this post
- Redirect CheckerTest any URL’s redirects: every hop’s status code, Location and time, with loops and wasted hops called out.
- HTTP Header CheckerInspect any URL’s response headers and get a security-header report card.
- Website Health CheckerOne scored report: uptime, SSL, DNS, speed, redirects, security headers, SPF and DMARC.


