Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Server redirect dropping query string (301 to /): how to fix it

TRK-334High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

The query string is the part of a URL after the ?, such as ?utm_source=google&gclid=abc123. It carries your campaign tags and ad click IDs. A server redirect is a response (usually a 301 or 302) that tells the browser to go to another address.

This issue happens when the redirect target is written as a plain path, like /, and the query string is not added to it. The visitor lands on the right page, but the address no longer holds any tracking data. Because analytics tags read the URL on arrival, they never see the parameters.

Where the tracking data is lost
  1. Ad click/old-offer?utm_source=google&gclid=abc123
  2. Server 301 to /Query string not carried over
  3. Landing pageURL is just /
  4. Analytics and ad tagsNo gclid or UTMs to read
  5. ConversionCounted as direct or unmatched

The ad click is fine. The redirect is the break, and everything after it works with no campaign data.

Why it costs you leads or sales

You still get the visitor, but you lose the proof of where they came from. Paid traffic gets reported as direct, so channels look worse than they are and budgets get cut for the wrong reasons. Google Ads and Meta cannot link the conversion to the click, which weakens automated bidding and optimisation.

Reported paid conversions before and after the redirectExample numbers
Reported paid conversions before and after the redirect (example)Redirect keeps query string: 100 conversions; Redirect drops query string: 35 conversions0387710035Redirect keeps query …Redirect drops query …conversions

Example: the same 100 real paid conversions, reported with and without the redirect stripping the query string.

A redirect removes the tags

The tagged URL goes in, a bare URL comes out.

How to check if your site has it

Test a tagged URL by hand
  1. Build a test URL

    Take a URL that is redirected, such as an old page, the non-canonical host or a campaign link, and add ?utm_source=test&utm_medium=cpc&gclid=TEST123.

  2. Follow the redirect

    Open it in a browser and look at the address bar after the page loads. If the parameters are gone, the redirect dropped them.

  3. Inspect the headers

    Run the command below and read the Location header of each hop. A Location of / with no query string confirms the problem.

  4. Check every hop

    Chains such as http to https to www to a final page can each drop parameters. Test each one.

See each redirect and where it pointsbash
curl -sIL "https://example.com/old-offer?utm_source=test&gclid=TEST123" | grep -iE "^(HTTP|location)"

How to fix it

The fix is the same everywhere: make the redirect pass the original query string to the target. How you do it depends on where the rule lives. Find the rule first, since it may be in the server config, a plugin, your CMS or a CDN.

Keep the query string on redirects
  1. Apache .htaccess with mod_rewrite

    Add the QSA flag (query string append) or let the rule pass it through. Example: RewriteRule ^old-offer/?$ / [R=301,L,QSA]. Note that with mod_rewrite, a target without a ? already keeps the original query string, but a target ending in ? removes it. Delete any trailing ?.

  2. Apache mod_alias Redirect

    Redirect 301 /old-offer /new-offer keeps the query string by default. If you used RedirectMatch, make sure the target does not end in ?.

  3. nginx

    Use return 301 /new-offer$is_args$args; instead of return 301 /new-offer;. With rewrite, a trailing ? on the target removes arguments, so remove it.

Apache rule, before and after

Drops the query string

  • RewriteRule ^old-offer/?$ /? [R=301,L]
  • Trailing ? clears the query string
  • Lands on / with no gclid or UTMs

Keeps the query string

  • RewriteRule ^old-offer/?$ / [R=301,L,QSA]
  • Original parameters are passed on
  • Lands on /?utm_source=...&gclid=...

How to confirm it's fixed

Confirm after the change
  • Clear your browser and CDN cache, since 301s are cached hard.
  • Open the tagged test URL and confirm the parameters are still in the address bar after loading.
  • Run the curl command and check each Location header contains the query string.
  • In GA4 Realtime or DebugView, check that the visit shows your test source and medium.
  • Check the cookies the page sets (for example _gcl_aw) to confirm the click ID was stored.
  • Test the http, https, www and non-www versions of the URL.

How to prevent it happening again

Redirects get added during migrations, SEO clean-ups and plugin installs, often by people who never test with campaign URLs. Keep a short list of rules and test each one with a tagged URL when it is added.

Habits that keep parameters safe
  • Always test redirects with a URL that has utm_ and gclid parameters.
  • Never end a redirect target with a bare ? unless you mean to clear it.
  • Point ads at final URLs, not at redirected ones.
  • Keep all redirect rules in one place and note who owns them.
  • Re-test after site migrations, plugin updates, CDN changes and new language or geo rules.

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor opens your landing page with test parameters added (marked as FunnelGuard test traffic), follows the redirects, and compares what arrives with what was sent. It then checks whether the parameters persist, meaning they are still in the final URL and stored where your tags expect them.

If the query string is lost, you get one alert, after the failure is re-checked from a second region, with a screenshot and a likely cause. It checks the journeys you set up, on a schedule, so it will not find every redirect on your site. The Free plan covers 1 site and 2 journeys with daily checks and no card.

Frequently asked questions

The most common questions are answered below.

Questions people ask

Why is my 301 redirect removing UTM parameters?

The rule most likely sends visitors to a fixed address such as / without adding the original query string. A trailing ? in an Apache or nginx rewrite target also clears it. Change the rule so the query string is passed through.

How do I keep the query string in an htaccess redirect?

With mod_rewrite, add the QSA flag and make sure the target has no trailing ?, for example RewriteRule ^old/?$ /new [R=301,L,QSA]. A plain Redirect 301 from mod_alias already keeps the query string. Test with a tagged URL afterwards.

How do I keep the query string in an nginx redirect?

Use return 301 /new-page$is_args$args;. This adds a ? only when there are arguments and appends them. Avoid a trailing ? on rewrite targets, as it removes the arguments.

Why is my gclid missing after a redirect?

The redirect probably removed it with the rest of the query string. Because gclid is read from the landing URL, it is never stored. Fix the redirect or send ads to the final URL.

How can I test whether a redirect drops my tracking parameters?

Add ?utm_source=test&gclid=TEST123 to the redirected URL and open it. If the address bar loses the parameters, or curl -sIL shows a Location header without them, the redirect drops them.

Does a 301 redirect hurt Google Ads tracking?

A 301 is fine when it keeps the query string. It hurts tracking only when it drops gclid and other parameters before the page loads. Auto-tagging also needs the final page to receive the gclid.

Can FunnelGuard tell me if my redirect strips UTMs?

Yes. It loads your page with marked test parameters, follows the redirects and checks whether they are still there and stored. It alerts you with a screenshot and a likely cause when they are lost.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: redirects + persistence.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.