How to Preserve URL Parameters Through Redirects: Query Strings, UTMs, and Tracking Rules
query parametersUTM trackingredirect rulesattributiontechnical SEO

How to Preserve URL Parameters Through Redirects: Query Strings, UTMs, and Tracking Rules

RRedirect.live Editorial Team
2026-11-08
6 min read

A practical checklist for preserving, removing, and transforming query parameters, UTMs, and affiliate IDs through URL redirects.

Redirects do more than send visitors to a new page: they can determine whether campaign, affiliate, search, and product data arrives at the destination intact. This guide gives you a practical checklist for preserving, removing, or transforming URL parameters so redirects remain useful for attribution, SEO, and reliable link management.

Overview

A URL parameter is the portion of a URL after the question mark, such as utm_source=newsletter or ref=partner42. Several parameters can be joined with an ampersand:

https://example.com/offer?utm_source=email&utm_campaign=spring&ref=partner42

When this URL redirects, the query string may be preserved automatically, replaced by a destination query string, or discarded. The result depends on the redirect server, hosting configuration, edge platform, short-link service, and rule syntax. Never assume that a redirect preserves parameters simply because the browser reaches the correct page.

Before creating a rule, decide what should happen to each parameter:

Parameter typeTypical actionReason
UTM tagsPreserve or deliberately replaceMaintains campaign attribution and naming consistency
Affiliate or referral IDPreserve and validateConnects the visit to the correct partner or referral
Search, filter, or sort valuesPreserve only when the destination supports themAvoids sending visitors to an irrelevant or empty result
Session, preview, or temporary tokensUsually remove unless requiredReduces leakage, duplication, and stale-session behavior
Unknown parametersAllow-list, drop, or pass through intentionallyMakes tracking behavior predictable and safer to maintain

For a broader campaign-link workflow, see the UTM Link Management Guide. If you are changing many URLs during a migration, document parameter behavior alongside each source-to-destination mapping.

Checklist by scenario

  1. Define a consistent naming scheme for utm_source, utm_medium, and utm_campaign.
  2. Test the complete tagged URL, not only the clean short link.
  3. Confirm that every redirect hop retains the expected parameters.
  4. Check the final landing page and analytics reports for the expected source and campaign values.
  5. Decide whether existing destination parameters should be retained when the redirect adds UTMs. Combining query strings without a rule can create duplicate keys.

For example, a branded link such as https://go.example/spring might redirect to https://shop.example.com/offer?utm_source=partner&utm_medium=qr&utm_campaign=spring. If a visitor also supplies a coupon parameter, decide whether the final URL should contain both the campaign tags and coupon=SAVE10, and test that exact outcome.

Identify the required identifier, such as aff_id, ref, or a signed token. Preserve it through every hop, including tracking domains and checkout handoffs. Do not casually decode, rename, or reorder signed values; some systems validate the exact encoded string. Test a valid ID, a missing ID, an invalid ID, and a value containing reserved characters.

Search filters and product URLs

Parameters such as color=blue, sort=price, or page=2 are meaningful only if the destination interprets them. Preserve supported filters when redirecting a product or category URL. Remove obsolete filters when the new site uses different parameter names, and map them explicitly when an equivalent exists. Avoid forwarding every old parameter by default if it can create empty results or duplicate page variants.

QR codes and offline campaigns

A dynamic QR code redirect should usually point first to a stable management URL, where the destination and tracking rules can be updated without reprinting the code. Include only the parameters needed for the campaign. Scan the code on more than one device, follow the complete redirect path, and verify that the final URL still contains the intended campaign data. The guide to dynamic QR code redirects covers destination changes and campaign management in more detail.

Common implementation patterns

On Apache, a rewrite rule commonly uses the QSA flag when the existing query string should be appended to a destination query string. Without that instruction, a destination query string may replace the original one, depending on the rule.

On Nginx, a destination that includes the original arguments is often expressed with variables such as $args, for example a pattern conceptually equivalent to return 301 https://www.example.com$request_uri; or an explicitly constructed destination using $is_args$args. Exact syntax depends on whether the path, query string, or both are being changed, so test the deployed configuration rather than copying a pattern blindly.

In a redirect management platform or link redirect tool, look for settings named “forward query string,” “preserve parameters,” “append parameters,” or “allow-list.” If a platform offers both automatic pass-through and explicit parameter mapping, use explicit rules for important attribution or affiliate fields.

What to double-check

  • Redirect status: Choose a permanent redirect when the move is intended to last and a temporary redirect when the destination is genuinely provisional. Status choice does not, by itself, guarantee parameter preservation.
  • Redirect chains: Check the source, intermediate tracking URL, canonical URL, and final page. A later hop can drop parameters even if the first rule is correct.
  • Encoding: Preserve encoded values such as %2F, spaces, plus signs, and ampersands as data. An unescaped ampersand can turn part of a value into a separate parameter.
  • Duplicate keys: Decide how repeated values such as tag=a&tag=b should be handled. Different applications may use the first value, last value, all values, or none.
  • Parameter order: Most applications should not depend on order, but signatures and strict tests sometimes do. Preserve the required order for signed or validated URLs.
  • Case and spelling: Treat utm_source and UTM_Source as potentially different fields. Standardize names before launch.
  • Analytics visibility: Confirm that analytics receives the parameters after the final page loads, rather than relying only on the address bar.
  • Security and privacy: Do not pass passwords, private tokens, or unnecessary personal data through a URL. Remove sensitive values at the earliest safe point.

Use a redirect checker or browser developer tools to inspect each response. For a recurring operational process, pair parameter tests with a redirect monitoring and uptime audit.

Common mistakes

  • Assuming the browser proves success: A page can load while attribution has already been lost.
  • Appending parameters without checking the destination: This can produce duplicate UTMs, conflicting values, or malformed URLs.
  • Forwarding every parameter: Legacy filters, session IDs, and internal flags can create unwanted behavior.
  • Using a client-side redirect for a server-side need: JavaScript or meta-refresh redirects can behave differently from an HTTP redirect and add another failure point.
  • Testing only clean URLs: Always test tagged, filtered, encoded, and malformed inputs.
  • Changing parameter names during a migration without a mapping: If the new site expects campaign_id but the old links send cid, create and document a transformation rule.
  • Ignoring the final canonical URL: A canonicalization or trailing-slash redirect can be the hop that removes the query string.

Keep a small test matrix for each important redirect: clean source, UTM-tagged source, affiliate value, duplicate parameter, encoded value, and an unsupported parameter. Record the expected final URL and analytics outcome.

When to revisit

Review parameter-handling rules before seasonal planning cycles, major campaign launches, domain changes, and site migrations. Revisit them whenever your analytics taxonomy, affiliate platform, QR destination, checkout flow, hosting configuration, or redirect management platform changes.

A practical maintenance routine is:

  1. Export or list active redirect rules and their intended parameter behavior.
  2. Mark each parameter as preserve, remove, replace, transform, or reject.
  3. Run the test matrix against production-like URLs.
  4. Inspect the full redirect chain and final analytics data.
  5. Update the rule documentation and campaign templates.
  6. Monitor the highest-value links after release and investigate sudden attribution gaps.

When a migration includes hundreds or thousands of URLs, combine this checklist with a bulk URL redirect plan and keep parameter rules close to the redirect map. Treat query-string behavior as part of the redirect specification, not as a last-minute implementation detail.

Related Topics

#query parameters#UTM tracking#redirect rules#attribution#technical SEO
R

Redirect.live Editorial Team

SEO and Redirect Management Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.