usdigitalmarketingindex.com SEO
How should legacy query-string parameters be handled during a URL migration?
Updated November 15, 2026
Parameter by parameter, according to what each one does. A query string on an old URL can be a tracking tag that changes nothing, a functional state such as a sort order or a page number, or the only identifier of a piece of content, as in ?id=482. These need different treatment when URLs change. Tracking parameters are carried across untouched so that campaigns keep working. Functional parameters are mapped to their new equivalents or dropped. Content-identifying parameters are mapped individually to the new URLs of the content they identified. One blanket rule, whether “strip everything” or “pass everything through”, gets at least one of the three wrong. The work is to list the parameters, classify each, and write a rule for each class.
Inventorying real parameter uses
Find every parameter that occurs on the old site’s URLs.
| Source | What it shows |
|---|---|
| Server logs | Every parameter requested, with counts |
| Crawl of the old site | Parameters in internal links |
| Search Console performance and page indexing reports | Parameterized URLs that are indexed or receive clicks |
| Links report | Parameterized URLs that other sites link to |
| Analytics | Parameterized landing pages |
| Application code and CMS configuration | Parameters the site reads and what they do |
| Marketing teams | Campaign tags in use, in email, ads, and QR codes |
For each parameter, record its name, example values, what the application does with it, how many URLs carry it, and whether any such URLs are indexed or linked.
Then classify.
| Class | Definition | Examples |
|---|---|---|
| Tracking | Read by analytics; the page is identical without it | <!–INLINECODE1–>, <!–INLINECODE2–>, <!–INLINECODE3–>, <!–INLINECODE4–> |
| Functional, view state | Changes how the same content is displayed | <!–INLINECODE5–>, <!–INLINECODE6–>, <!–INLINECODE7–> |
| Functional, subset | Selects part of a set | <!–INLINECODE8–>, <!–INLINECODE9–>, <!–INLINECODE10–>, <!–INLINECODE11–> |
| Content-identifying | The parameter is the content's address | <!–INLINECODE12–>, <!–INLINECODE13–>, <!–INLINECODE14–>, <!–INLINECODE15–> |
| Session or user | Identifies a visitor | <!–INLINECODE16–>, <!–INLINECODE17–> |
| Obsolete | No longer read by anything | Old campaign or platform parameters |
The class decides the rule. A parameter cannot be handled correctly until someone has confirmed, in the code or by testing, what it does.
Mapping parameter rules
| Class | Rule in the migration |
|---|---|
| Tracking | Preserve through the redirect: the old path redirects to the new path with the tracking parameters appended unchanged |
| View state | Drop, or map to the new parameter name if the new site supports the same view |
| Subset, pagination | Map to the new pagination scheme |
| Subset, filters | Map to the new filter URL where an equivalent exists; otherwise redirect to the unfiltered listing |
| Content-identifying | Map each value to the new URL of that content, row by row |
| Session or user | Strip |
| Obsolete | Strip |
Examples, for a site moving from parameter-based to path-based URLs:
Tracking, preserved:
/services.php?page=repair&utm_source=newsletter
-> 301 -> /boiler-repair/?utm_source=newsletter
Content-identifying, mapped individually:
/article.php?id=482
-> 301 -> /guides/boiler-pressure/
/article.php?id=483
-> 301 -> /guides/bleed-a-radiator/
View state, dropped:
/products.php?cat=boilers&sort=price
-> 301 -> /boilers/
Pagination, mapped:
/products.php?cat=boilers&pg=3
-> 301 -> /boilers/?page=3
Session, stripped:
/boiler-repair.php?sessionid=A1B2C3
-> 301 -> /boiler-repair/
Unknown id, no content:
/article.php?id=99999
-> 404
Content-identifying parameters are the ones a blanket rule destroys. If the redirect matches on the path alone, every article.php?id=... goes to one destination, and hundreds of distinct articles collapse into a single URL. These need a lookup table from value to new URL, built from the database.
Mixed query strings need an order of operations: resolve the content-identifying parameter to a destination, map or drop the functional ones, then append the surviving tracking parameters.
Preventing infinite variants
Parameters multiply URLs. The migration is a chance to stop that, and a risk of making it worse.
Google’s URL guidance for ecommerce sites gives relevant recommendations: use ?key=value parameters, “Avoid using the same parameters twice”, and avoid internally linking to temporary parameters such as session IDs and tracking codes (Google’s guidance on URL structure for ecommerce sites).
| Risk | Control |
|---|---|
| Unknown parameters passed through to the new site create new URL variants | Whitelist: only named parameters survive the redirect |
| Parameter order produces duplicates | Normalize order on the new site |
| Repeated or empty parameters | Strip |
| Tracking parameters on the new site get indexed | Canonical tag on the new page names the clean URL |
| Redirects that append parameters on each hop | Test for growth: the output URL must not gain parameters with each request |
| New site links internally with tracking parameters | Remove them from internal links |
| Redirect rule matches its own output | A loop; test every rule against its result |
| Case and encoding variants | Normalize before matching |
A whitelist is safer than a blacklist. Ad platforms and email tools attach parameters of their own, and a rule that strips only known-bad ones lets each new arrival through. Preserving the recognized tracking set and discarding the rest of the unrecognized ones keeps the URL space bounded. Weigh that against analytics needs, and agree the list with the marketing team.
Testing conversion and analytics
A parameter mapping test matrix:
| # | Old URL | Class | Expected action | Expected result | Actual | Pass |
|---|---|---|---|---|---|---|
| 1 | /services.php?page=repair | Content-identifying | Redirect | 301 to /boiler-repair/ | ||
| 2 | <!–INLINECODE20–> | Content plus tracking | Redirect, retain tracking | 301 to <!–INLINECODE21–> | ||
| 3 | /article.php?id=482 | Content-identifying | Redirect | 301 to /guides/boiler-pressure/ | ||
| 4 | /article.php?id=99999 | Content-identifying, no match | No redirect | 404 | ||
| 5 | /products.php?cat=boilers&sort=price | View state | Redirect, discard sort | 301 to /boilers/ | ||
| 6 | /products.php?cat=boilers&pg=3 | Pagination | Redirect, map | 301 to /boilers/?page=3 | ||
| 7 | /boiler-repair.php?sessionid=A1B2C3 | Session | Redirect, discard | 301 to /boiler-repair/ | ||
| 8 | /boiler-repair.php?gclid=XYZ | Tracking | Redirect, retain | 301 to /boiler-repair/?gclid=XYZ | ||
| 9 | /boiler-repair.php?foo=bar | Unknown | Redirect, discard | 301 to /boiler-repair/ | ||
| 10 | /products.php?sort=price&cat=boilers | Reordered | Same as 5 | 301 to /boilers/ | ||
| 11 | /article.php?id=482&id=483 | Repeated | Defined behavior | As specified in the rule | ||
| 12 | <!–INLINECODE22–> | New URL with tracking | Retain | 200; canonical names /boiler-repair/ |
For every row also record the number of hops, which should be one.
Analytics and conversion checks:
| Check | Method | Pass condition |
|---|---|---|
| Campaign attribution survives | Click a tagged old link; view the session in analytics | Source and campaign recorded |
| Ad click identifiers survive | Follow an ad test link through the redirect | Identifier present on the landing URL |
| Email links | Send a test from the email platform | Lands on the right page with tags |
| Conversion paths | Complete a test conversion from a tagged old URL | Attributed correctly |
| Indexing of parameter URLs | Page indexing report over the following weeks | Old parameter URLs redirected; no growth in new parameter URLs indexed |
| Logs | Monitor requests for old parameter patterns | All answered by a rule; none falling through to an error unexpectedly |
Run the matrix on staging and again on production. Keep it with the redirect map.
On live pages that are not migrating, the standing question of how tagged URLs relate to their clean versions is covered in the guide to how tracked URLs with UTM parameters should point to their canonical versions.
The rule: classify every parameter, preserve tracking, map content identifiers one by one, map or drop functional states, strip the rest, and prove each rule with a test row.
Add your comment to this answer