UTM Redirect: How to Keep UTM Parameters Through Redirects

July 29, 2026
6 mins read
UTM Redirect: How to Keep UTM Parameters Through Redirects

UTM parameters survive a redirect only if the address the redirect sends the browser to still carries them. Browsers follow the Location header exactly, so when a rule rewrites the URL without the query string, utm_source, utm_medium and utm_campaign are gone before your analytics tag runs, and the visit is reported as direct or referral traffic instead of your campaign.

Direct Answer

To keep UTM parameters through a redirect, make every hop forward the query string. On Apache, leave the target without its own query string or add the [QSA] flag. On Nginx, redirect to $request_uri. On Cloudflare Single Redirects or Bulk Redirects, turn on Preserve query string (it is off by default). On a redirect service, turn on query forwarding. Then open a tagged URL and check that the final address still shows every utm_ value.

Why UTM parameters disappear after a redirect#

A 301 or 302 redirect is a short response with a Location header. The browser requests the URL in that header and nothing else, so the query string only survives if the rule puts it there. UTMs usually go missing for one of these reasons:

  • The rule drops the query string. Cloudflare Single Redirects and Bulk Redirects do this until Preserve query string is turned on.
  • The rule writes its own query string. On Apache, a RewriteRule target that contains a ? replaces the incoming query string unless you add the [QSA] flag.
  • The redirect points at one fixed URL. A rule such as return 301 https://example.com/; in Nginx sends every visitor to the same bare address.
  • A second hop strips it. The first redirect keeps the UTMs, then the destination redirects again (http to https, non-www to www, a trailing slash, a login or cookie-consent page) and that rule drops them.
  • A JavaScript or meta refresh redirect builds the new address from a hard-coded URL instead of copying the current query string.
  • The UTMs arrive but are recorded differently. Google Analytics treats values as case sensitive (utm_source=google and utm_source=Google are different), and a missing parameter shows up as (not set).

How common redirect setups handle the query string#

The default differs by tool, which is why the same campaign link can work on one domain and lose its tags on another:

SetupQuery string by defaultTo keep UTMs
Apache RewriteRule, target without ?Copied to the targetNothing to change; don't add [QSD]
Apache RewriteRule, target with its own ?Replaced by the target's query stringAdd [QSA] to combine both
Nginx return 301 with $request_uriKept ($request_uri includes the arguments)Use $request_uri, not a fixed URL
Nginx rewriteAppended after any new argumentsDon't end the replacement with ?
Netlify _redirects (301 or 302)Passed on automaticallyNothing, unless a rule matches on query parameters
Cloudflare Single Redirects or Bulk RedirectsDroppedTurn on Preserve query string
RedirHub domain redirect or short linkForwarded when Query forwarding reads Query keptCheck the Query forwarding option

On Nginx, a whole-domain redirect that keeps both the path and the UTMs looks like this:

nginxserver {
    listen 80;
    server_name oldbrand.com www.oldbrand.com;
    return 301 https://mybrand.com$request_uri;
}

On Apache (.htaccess), a rule that adds its own query string needs [QSA], or the visitor's UTMs are replaced:

apacheRewriteEngine On
RewriteRule ^promo$ https://mybrand.com/landing?ref=promo [QSA,R=301,L]

Sources, checked November 2026: Apache RewriteRule flags, nginx rewrite module, nginx $request_uri, Netlify redirect options, Cloudflare Single Redirects settings and Cloudflare Bulk Redirects parameters.

How to keep UTM parameters through a redirect, step by step#

Run through these steps for each campaign link before you send traffic to it:

  1. Build one test URL with every UTM you plan to use, for example https://oldbrand.com/sale?utm_source=newsletter&utm_medium=email&utm_campaign=summer-sale.
  2. Open it in the redirect speed test or run curl -sIL on it, and note every hop and its Location header.
  3. Find the first hop whose Location no longer contains the utm_ values. That rule is the one to fix.
  4. Fix that rule: turn on query forwarding (Preserve query string on Cloudflare), add [QSA] on Apache, or redirect to $request_uri on Nginx.
  5. Cut extra hops: point the first redirect straight at the final https address, so a later http-to-https or www rule can't drop the query string.
  6. Run the test URL again and confirm the final address shows every utm_ value, spelled and capitalised the way you sent it.
  7. Visit the test URL once more and check your analytics tool's real-time view: the visit should be credited to the expected source, medium and campaign.

Is your redirect working? Enter your domain. You'll see the status code (301 or 302), where it lands, whether HTTPS is valid, and how fast it answers from Washington, Frankfurt and Tokyo, ranked against every redirect tested in the last 7 days.

Test my redirect

A working example: on 11 November 2026 we traced http://redirhub.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=test. It answered with a single 301 to https://www.redirhub.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=test, so the scheme and host changed in one hop and all three UTMs arrived.

UTMs that arrive with the click vs UTMs the redirect adds#

Inbound UTMs are already on the link when someone clicks: an ad platform, email tool or social scheduler adds them. For these, the redirect's only job is to forward the query string untouched.

Some links can't carry tags: a printed QR code, a vanity domain on a billboard, a short link someone types from memory. Here the redirect itself adds a fixed set of UTMs to every visit. Pick one approach per link. If a tagged click also gets fixed tags added, the same parameter can appear twice, so test what your redirect tool does when both are present.

Whichever you use, Google Analytics recommends always setting utm_source, utm_medium and utm_campaign, and its values are case sensitive, so agree on lowercase names such as summer-sale and use them everywhere (Google Analytics: collect campaign data with custom URLs).

Keep UTMs with RedirHub#

RedirHub serves domain redirects, short links and QR codes from 130 global edge locations (PoPs), close to each visitor. Two options in the redirect form deal with campaign tags:

  • Query forwarding: with Forward query parameters switched on, the row reads Query kept, and oldbrand.com/?ref=ig lands on the destination with ?ref=ig kept. Path and query forwarding are included on every plan.
  • UTM parameters: fill in utm_source, utm_medium, utm_campaign, utm_term and utm_content once, and they are added on every redirect.

To set it up:

  1. In the dashboard, choose Domain Redirect.
  2. Enter the old domain under Redirect from and the destination under Redirect to.
  3. Choose 301 · Permanent (or 302 · Temporary for a short campaign) and Keep the path.
  4. Under Options, click More options.
  5. Open Query forwarding and check that Forward query parameters is on, so the row reads Query kept.
  6. If the link needs fixed tags, open UTM parameters and fill in the fields.
  7. Click Create redirect. If the domain isn't connected yet, the redirect goes live once its DNS points to RedirHub.
RedirHub New domain redirect form: oldbrand.com to https://mybrand.com, 301 · Permanent, Keep the path, Query forwarding reading Query kept, and UTM parameters open with utm_source print, utm_medium flyer, utm_campaign summer-sale and utm_content back-cover

The same options appear when you create branded short links on your own domain, and the UTM fields are handy for dynamic QR codes, because a printed code can't be re-tagged later. For a campaign with hundreds of tagged URLs, a bulk CSV import creates them in one go and shows what will be added, updated or removed before anything is written.

Server or CDN redirect ruleRedirHub
Query stringDepends on the rule (see the table above)Query forwarding option, on every plan
Fixed UTM tagsTyped into each target URLUTM parameters fields on each link
Root and wwwOften separate rules and certificatesCount as one domain; HTTPS issued and renewed automatically for both
DNS and emailUnchangedUnchanged; only the root and www records change
Redirect types301, 302, 307, 308301, 302, 307, 308 and frame redirects
Click dataServer or CDN logsClicks and unique visitors, with a Humans only switch that leaves bots out
PriceIncluded with your hosting or CDNFrom $49/month Core; 14-day free trial on Pro

If your site already runs on Nginx, Apache or Netlify and you only need a few redirects, a correct rule is free and keeps UTMs just as well. RedirHub is worth it when you manage many domains or campaign links, need tags added to links you can't edit, or want click data without reading server logs.

Frequently asked questions

It means carrying query-string values such as utm_source, utm_medium and utm_campaign from the original URL to the final destination, so analytics can credit the visit to the right campaign.

Only if its Location header includes them. The browser goes to exactly the URL in Location, so a 301 keeps UTMs when the rule forwards the query string and drops them when it points at a fixed URL.

Turn on query forwarding (or use $request_uri on Nginx, or [QSA] on Apache when the target has its own query string), remove extra hops, and test a tagged URL until the final address shows every utm_ value.

Not by default. Single Redirects and Bulk Redirects have a Preserve query string setting that is off until you turn it on.

Usually a rule drops or replaces the query string, a second hop (http to https, www, trailing slash, login page) strips it, or a JavaScript redirect uses a hard-coded URL. Trace every hop to find the one that loses the utm_ values.

Open a URL with test UTMs in a redirect checker or run curl -sIL on it, and compare the final address with the one you sent. The first hop whose Location loses the utm_ values is the rule to fix.

Yes. Many redirect tools can add fixed tags to every visit, which suits printed QR codes and vanity domains. Use either the tags that arrive with the click or the tags the redirect adds for a given link, and test what happens when both are present.

Lowercase is easier to keep consistent. Google Analytics treats values as case sensitive, so utm_source=Google and utm_source=google are reported separately.

UTM parameters are tracking values, not a ranking signal. They can create duplicate URL variants, so keep a canonical URL on the landing page while preserving them for campaign attribution.

Leo Astarothman

Leo Astarothman is the Brand & Content Lead at RedirHub, where he shapes the company's visual identity, educational content, product experiences, and marketing strategies. He also specializes in system design. Simplifying complex redirect infrastructure into practical resources, product experiences, and campaigns that help businesses understand and adopt modern redirect management.