TapCub is live — analytics, insights and live chat, free on one platform
Analytics

301 vs 302 redirect: which to use and what it does to tracking

301 says a move is permanent and 302 says it is temporary. How 307 and 308 differ, what Google does with each, why UTM parameters vanish, and how to test redirects with curl.

Emma Collins Published Dec 3, 2026 14 min read Analytics
Sample data: the same 14,000 sessions in both versions. Dropping the query string moves all 4,000 newsletter sessions and their 120 conversions into direct.Sample data

A 301 redirect says a URL has moved permanently; a 302 says the move is temporary and the original URL should keep being used. Google treats the first as a strong signal to show the new address. Neither one keeps your UTM parameters unless the redirect rule copies the query string into the target.

What you will learn

  • Use 301 or 308 for permanent moves and 302 or 307 for temporary ones; 307 and 308 keep the request method
  • A redirect drops UTM parameters when its target omits the query string, whatever the status code
  • Browsers may cache a 301, so launch as 302, verify targets and parameters, then make it permanent

What is the difference between a 301 and a 302 redirect?

Both tell a client that the content it asked for is at another URL, given in the Location header. The difference is the promise attached. 301 Moved Permanently says the resource has a new permanent address and future references should use it. 302 Found says the resource is temporarily somewhere else, and the client should keep using the original URL next time. Those definitions come from RFC 9110, the HTTP standard published in June 2022.

Two more codes exist because of an old accident. The standard allows a browser to turn a POST into a GET when it follows a 301 or 302, so 307 and 308 were added to forbid that change. The result is a two-by-two grid plus one special case:

May change POST to GETKeeps the method
Permanent301 Moved Permanently308 Permanent Redirect
Temporary302 Found307 Temporary Redirect

The special case is 303 See Other, which sends the client to a different resource that answers the original request, typically a result page after a form submission.

The numbers do not say how long "temporary" lasts. RFC 9110 sets no duration. What it gives you is intent, and clients act on it: whether to remember the new address, whether to cache the answer, and, for search engines, which of the two URLs to show.

CodeDurationMethodCacheable by defaultGoogle signal for the target
301 Moved PermanentlyPermanentPOST may become GETYes, heuristicallyStrong
302 FoundTemporaryPOST may become GETNoWeak
303 See OtherPoints to a result resourceFollow with GET or HEADNoTreated as temporary
307 Temporary RedirectTemporaryKeptNoSame as 302
308 Permanent RedirectPermanentKeptYes, heuristicallySame as 301

Method and caching rules from RFC 9110 section 15.4; Google treatment from its redirect and status code documentation, checked 2026-12-03.

Which redirect status code should you use?

Decide two things in order. First, will this redirect ever be removed or pointed somewhere else? Second, does the request carry a method and body that must survive, as with form posts and API calls?

SituationCodeReason
Page moved to a new URL for good301Permanent, widely understood
Site moved to a new domain or to https301 or 308Permanent; use 308 where POST must stay POST
API endpoint renamed for good308The method and body are preserved
Short sale page standing in for a product page302The original URL will return
Maintenance detour for a form or API307Temporary and keeps the method
Redirect after a successful form post303The next request should be a GET for the result
Country or language suggestion302, or no redirectThe choice depends on the visitor, and may change
Page removed with no replacementNo redirect: 404 or 410Sending everyone to the home page hides the removal

For the last row, the reasoning and a triage method are in how to fix 404 errors. If you are unsure whether a move is permanent, a 302 is the cheaper mistake: browsers do not cache it by default, so you can change your mind. Switch to 301 once the decision is made.

What do 301 and 302 redirects mean for Google Search?

Google's redirect documentation splits redirects the same way. With a permanent server-side redirect (301 or 308), Googlebot follows it and uses it as a signal that the target should be the canonical URL, so the new address is the one to show in results. With a temporary one (302, 303 or 307), Google follows it but does not treat it as that signal, so the old URL is more likely to stay in results.

The page on how status codes affect Google's crawlers puts it as a strong signal for 301 and a weak signal for 302 that the target should be processed, with 308 treated like 301 and 307 like 302. The same page notes that the codes are still semantically different, so other clients benefit when you pick the accurate one.

Three practical points follow.

  • Hop count. Google's crawlers follow up to 10 redirect hops by default. Aim for one. A sequence of rules that grew over several migrations is a redirect chain, and it costs time on every visit.
  • How long to keep them. For a site move, Google advises keeping redirects as long as possible, generally at least one year.
  • Other kinds of redirect. Google reads an instant meta refresh as permanent and a delayed one as temporary. JavaScript redirects depend on rendering succeeding, so use them only when server-side and meta refresh are not possible.

A long-running 302 is not automatically a problem, and no published number of days turns it into a 301. If the move is permanent, say so with the status code instead of waiting for a search engine to infer it.

Do redirects keep UTM parameters and the referrer?

This is where a redirect that "works" can still damage reporting. The two pieces of information travel differently.

UTM parameters live in the URL. The browser requests whatever address is in Location. If the rule writes a new URL without the original query string, utm_source, utm_medium and ad click IDs are gone before the page loads. This has nothing to do with 301 versus 302; either code drops them if the target omits them. The UTM parameters have to be copied into the target by the rule.

The referrer travels in a request header. When a browser follows a server redirect, it still determines the Referer from where the navigation started, under the referrer policy in force. Three things change what arrives:

What happens on the wayEffect on the referrer at the final page
A normal HTTPS 301 or 302The original referring site is still reported, trimmed by policy
The redirect response sends its own Referrer-PolicyThat policy replaces the request's policy for the next hop; no-referrer removes it
A hop from https to httpUnder the default strict-origin-when-cross-origin, no referrer is sent to the less secure address
Meta refresh or JavaScript redirectIt is a new navigation from the intermediate page, so the referrer is normally that page, if its policy allows one

The default policy also sends only the origin, not the full path, across sites. That is normal and not a redirect fault; see referrer policy strict-origin-when-cross-origin.

When both are lost, the visit has nothing to identify it and lands in direct traffic. When only the parameters are lost, it may be reported as a referral or social visit, so the traffic is there but the campaign is not.

One thing a redirect does keep without help: a fragment. RFC 9110 says that if Location has no # part, the browser applies the fragment of the original URL to the new one.

Worked example: a campaign that turned into direct traffic

Sample data: a newsletter links to https://example.com/offer?utm_source=newsletter&utm_medium=email&utm_campaign=spring. During a URL cleanup, someone adds a 301 from /offer to /spring-offer without the query string. Email programs usually send no referrer, so nothing identifies the visitors.

In one week the newsletter brings 4,000 sessions that convert at 3%, which is 120 conversions. Without the redirect fault, direct traffic would have been 10,000 sessions with 200 conversions.

Channel in the reportCorrectWith the query string dropped
Email sessions4,0000
Email conversions1200
Email conversion rate120 ÷ 4,000 = 3.0%no data
Direct sessions10,00014,000
Direct conversions200320
Direct conversion rate200 ÷ 10,000 = 2.0%320 ÷ 14,000 = 2.29%
Total sessions and conversions14,000 and 32014,000 and 320

The totals are identical, which is why nobody notices on a headline dashboard. The damage is in the split: the newsletter appears to have done nothing, and direct traffic appears to have grown by 40% and improved its conversion rate. A budget decision made on that table would cut the channel that worked.

The fix is one change to the rule so that the target carries the query string. Visits already recorded do not change, so note the dates on which the rule was wrong.

app.tapcub.com

Sessions by channel when a redirect drops the query string

sample week
Direct · query string dropped14,000
Direct · rule fixed10,000
Email · rule fixed4,000
Email · query string dropped0
Sample data
Sample data: the same 14,000 sessions in both versions. Dropping the query string moves all 4,000 newsletter sessions and their 120 conversions into direct.

Why do 307 and 308 exist?

For a normal page view the method is GET, and the four codes behave the same in a browser. The difference appears when something sends data. RFC 9110 notes that early browsers disagreed about whether to repeat a POST after a 301 or 302, practice settled on changing it to GET, and 307 and 308 were added to mean "repeat exactly what you sent".

A payment callback, a webhook or a mobile app posting events to an old endpoint can therefore arrive at the new address as an empty GET after a 301. The sender sees a redirect that succeeded; the receiver sees no body. Use 308 for a permanent move of such an endpoint, and 307 for a temporary one. Better still, update the sender, because not every HTTP client follows redirects for non-GET requests.

The command-line tool curl behaves the same way: with -L, it follows a POST with a GET after 301, 302 or 303, and resends the same method after other 3xx codes.

Why is a wrong 301 hard to take back?

RFC 9110 marks 301 and 308 responses as heuristically cacheable: unless explicit cache headers say otherwise, a cache may store them and decide for itself how long. 302 and 307 carry no such permission.

In practice, a visitor who received a mistaken 301 may keep going to the wrong target without asking your server again, and removing the rule on the server does not reach them. Two habits reduce the risk:

  1. Launch with a 302, then switch. Run the new rule as temporary for a day, check the targets and the query strings, then change the code to 301.
  2. Set a cache lifetime on permanent redirects. An explicit header such as Cache-Control: max-age=3600 during the first weeks limits how long a mistake survives. Lengthen it once the rule has proved correct.

If a wrong 301 is already out, you can redirect the wrong target back or publish content there, but you cannot clear other people's caches.

How to write the rule so the query string survives

Syntax differs, and so does what happens to the query string by default.

Server and directiveRuleQuery string
nginx returnreturn 301 https://example.com/spring-offer$is_args$args;Only what you write is sent, so include $is_args$args
nginx rewriterewrite ^/offer$ /spring-offer permanent;Original arguments are kept, and appended after new ones; a trailing ? drops them
Apache RedirectRedirect 301 /offer https://example.com/spring-offerPassed on to the target
Apache mod_rewriteRewriteRule ^/offer$ /spring-offer [R=301,L]Passed through unless the substitution has its own query; the QSD flag discards it

Note the defaults hiding in these tools: Apache's Redirect without a status argument and nginx's rewrite ... redirect both produce a 302. A rule meant to be permanent has to say so. The Apache behavior is documented for mod_alias and mod_rewrite. Paths in .htaccess files are matched differently from server configuration, so test where you put the rule.

How to test a redirect with curl

Run these against the real campaign URL, with its parameters, and quote the URL so the shell does not split it at &.

  1. See the first response. curl -sI "https://example.com/offer?utm_source=test&utm_medium=email" prints the status line and location. Check the code and whether the parameters are in the target.
  2. Follow the whole path. Add -L to print the headers of every hop.
  3. Summarize. curl -s -o /dev/null -L -w "%{http_code} %{num_redirects} %{url_effective}\n" "URL" prints the final status, the number of hops and the final address, using a GET request. Some servers answer a header-only request differently, so run this too.
  4. Check the variants. Repeat with http://, with and without www, with a trailing slash and with an ad click ID.
  5. Check the referrer headers. Look for a referrer-policy line on any redirect response.

For many URLs at once, feed a list to a crawler or a script; how to check URL status codes covers building the list and ranking the failures.

How to verify the effect in TapCub

Take the newsletter above. Server redirects happen before the analytics script loads, so TapCub records the final page and whatever address and referrer arrived with it. That makes it a good end-to-end check.

  1. Click your own test link. Open the campaign URL with a test campaign name, then look at Web analytics › Realtime to confirm the visit arrived on the new page.
  2. Check the campaign. In Web analytics › Sources, open the UTM tab. UTM values are read from the address of the pageview, so if the test campaign is missing, the rule dropped the parameters.
  3. Look for the shift. In the same report, compare the channel mix before and after the migration date. Email falling while direct rises by a similar amount is the pattern in the table above.
  4. Mark the dates. Record when the rule changed in Configuration › Annotations, so the broken week is not read later as a weak campaign.

TapCub does not create or manage redirects; those live in your server or CDN. To see which status codes search engine crawlers receive, you need server logs or server events, which feed Monitoring › Crawl health.

FAQ

Is a 301 or 302 better for SEO?

Neither is better in general; each states something different. Use 301 or 308 when the move is permanent, because Google treats it as a signal that the target should be canonical. Use 302 or 307 when the original URL will return, so that it can stay in search results.

Does a 302 redirect pass ranking signals?

Google's documentation describes a 302 as a weak signal that the target should be processed, and does not use temporary redirects as a signal that the target should be canonical. Other signals can still lead it to index the target. If you want signals to move, use a permanent redirect.

Do 301 redirects lose UTM parameters?

Only if the rule writes a target without them. The status code does not decide this. Test the actual campaign link with curl and read the location header. If the query string is missing there, change the rule so that it appends the original arguments to the new URL.

Can I change a 302 to a 301 later?

Yes, and it is a sensible order: launch as temporary, verify, then make it permanent. Going the other way is harder, because browsers may have cached the 301 and will not ask your server again until their copy expires or the visitor clears it.

How many redirects in a row are too many?

Google's crawlers follow up to 10 hops by default, but that is a limit, not a target. Each hop adds a round trip before the page starts to load. Point every old URL directly at the final address, and update your own links so they need no redirect at all.

Sources

Filed underAnalytics

Was this article helpful?

We use your answers to fix and expand this page.

Emma Collins

Product Analyst

Focuses on event analysis, conversion funnels, and retention, using clear metric definitions and structured analysis to explain product performance.

Check that campaigns survive your redirects

Realtime visits, sources and UTM breakdowns show whether tagged links still arrive tagged after a URL change.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics