Sub topic 9
URL variants and duplicate content
Prerequisites
This chapter assumes you know the basic structure of an HTML page, how URLs are built (scheme, host, path, query string, fragment), and what common HTTP status codes mean. It comes before the chapters on canonical URLs. Here you learn how duplicate URLs arise and why they cause problems. The next chapters cover the fix.
What duplicate content means
A search engine indexes URLs, not pages in the human sense. If the same content is reachable at several URLs, the engine sees several URLs. It must then decide which one to index and show. Duplicate content is the case where the same or nearly the same content appears at more than one URL, on one site or across sites.
Most duplication is not a penalty. Search engines cluster duplicates, pick one URL to represent the cluster, and filter the rest from results. The problems are practical:
- Split signals. Links and other signals may be spread across several URLs instead of adding up on one.
- Wrong URL shown. The engine may choose a variant you did not want, such as a parameter URL with tracking codes.
- Wasted crawling. Crawlers spend requests on near-identical URLs instead of new or updated pages. This matters most on large sites.
- Messy reporting. Analytics and search reports show the same page under several addresses.
Where URL variants come from
Each difference in a URL can make a new address, even when the server returns identical content. The common sources are listed below.
| Source | Example variants | Usually same content? |
|---|---|---|
| Protocol | `http://` and `https://` | Yes |
| Host | `example.com` and `www.example.com` | Yes |
| Trailing slash | `/shoes` and `/shoes/` | Yes |
| Letter case | `/Shoes` and `/shoes` | Often, depending on the server |
| Index files | `/shoes/` and `/shoes/index.html` | Yes |
| Tracking parameters | `?utm_source=news`, `?gclid=abc` | Yes |
| Session IDs | `?sid=8f3a2` | Yes |
| Sort and filter parameters | `?sort=price`, `?color=red` | Partly: reordered or reduced content |
| Pagination | `?page=2` | No, each page has different items |
| Print or mobile versions | `/shoes/print`, `m.example.com/shoes` | Yes |
| Parameter order | `?a=1&b=2` and `?b=2&a=1` | Yes |
| Fragment | `/shoes#reviews` | Same URL for indexing |
The fragment (the part after #) is not sent to the server. Search engines treat a URL with a fragment as the URL without it, so fragments do not create duplicates in the index.
Paths are case-sensitive in the URL standard, and many servers treat /Shoes and /shoes as different resources. Hosts and schemes are not case-sensitive. A server that returns the same page for both path cases is producing a duplicate.
The same content in different places
Duplication also crosses the URL structure of a single site:
- A product listed in two categories, each with its own path (
/men/boots/x1and/sale/x1). - Syndicated articles republished on partner sites.
- Near-duplicates, such as product pages that differ only by color and share a long description.
- A staging or test copy of the site left open to crawlers.
Near-duplicates are judged by how much of the main content overlaps, not by exact byte matches. Navigation, headers, and footers are usually ignored in that comparison.
How the engine handles duplicates
Search engines process duplicates in stages. The following diagram shows the general flow. Exact details differ between engines and change over time.
The selected URL is called the canonical URL. You can influence the choice with signals, but you do not control it directly. Signals the engine weighs include:
- Redirects from variants to one URL.
- A
rel="canonical"hint on the variants. - Which URLs appear in your sitemap.
- Internal and external links pointing to each URL.
- Whether the URL uses HTTPS.
If these signals agree, the engine nearly always follows them. If they disagree, the engine picks by its own judgment, and the result may not be your preference. Later chapters cover each signal in detail.
Parameters: the hardest case
Query parameters cause the most duplicate URLs in practice, because the number of combinations grows quickly. A listing with five filters, each with a few values, can yield thousands of URLs.
It helps to sort parameters by what they do to the content:
- Do not change content. Tracking tags (
utm_*,gclid,fbclid), session IDs, and referrer codes. These URLs are true duplicates and should resolve to one clean URL. - Change order or subset. Sorting and filtering (
sort,color). The content is related to the base page but not identical. Whether to index these depends on whether people search for that subset. - Select different content. Pagination, language, or an item ID (
?id=42). These are separate pages and need their own indexable URLs.
The decision for each parameter belongs to you. A filter such as ?color=red may deserve its own page if people search for "red trail running shoes". A sort order almost never does.
Parameter order and normalization
The URLs ?a=1&b=2 and ?b=2&a=1 return the same content, but a crawler sees two strings. You can reduce this by generating links in a fixed parameter order and by dropping empty or default parameters. The helper below shows how to normalize a URL before using it in a link. It forces HTTPS, lowercases the host, removes the fragment and tracking parameters, and sorts what remains.
const IGNORED = new Set(["gclid", "fbclid", "sid"]);
function normalizeUrl(rawUrl) {
const url = new URL(rawUrl);
url.protocol = "https:";
url.hash = "";
const kept = [...url.searchParams.entries()]
.filter(([key]) => !key.startsWith("utm_") && !IGNORED.has(key))
.sort(([a], [b]) => a.localeCompare(b));
url.search = "";
for (const [key, value] of kept) {
url.searchParams.append(key, value);
}
return url.toString();
}
console.log(normalizeUrl("http://WWW.example.com/shoes?utm_source=news&sort=price&color=red#reviews"));
// https://www.example.com/shoes?color=red&sort=priceThe URL class already lowercases the host. It does not change the path case or add a trailing slash. Those choices are yours to make and apply consistently.
Finding duplicates on your site
You can check for variants directly. Request each form of a known page and compare the status code and final URL. The commands below use curl, which prints the status line and any Location header.
for u in \
"http://example.com/shoes" \
"http://www.example.com/shoes" \
"https://example.com/shoes" \
"https://www.example.com/shoes" \
"https://www.example.com/shoes/" \
"https://www.example.com/shoes?utm_source=test"
do
echo "== $u"
curl -sI "$u" | grep -iE '^(HTTP|location)'
doneA healthy site returns 200 for exactly one of these forms, and 301 redirects to that form for the rest. If several return 200 with the same content, those are live duplicates. Parameter URLs often return 200 by design, because the server ignores unknown parameters. For those, a canonical hint is the usual fix, which a later chapter covers.
Other ways to find duplicates:
- Search for a distinctive sentence from the page in quotes, with
site:yourdomain.com, and count the URLs that appear. - Review the indexing report in your search console tool for pages marked as duplicates, and note which URL the engine chose.
- Crawl your site with an audit tool and group pages by identical titles or content hashes.
Edge cases
- Case differences in paths. If
/Shoesreturns200and/shoesreturns200, both are live. Pick one form, redirect the other, and use that form in all links. - Trailing slash and files.
/shoes/often denotes a directory and/shoesa file or route. Either is fine, but serve one and redirect the other. Do not mix them in internal links. - Soft duplicates. Pages with different URLs and thin differences, such as a city page that only swaps the city name, may be clustered even though you consider them distinct. Add distinguishing content or merge them.
- Cross-domain copies. Syndicated content on another domain competes with your original. Ask the partner to point a canonical hint at your URL, or accept that their copy may be shown instead.
- Infinite spaces. Calendars, faceted search, and relative links with errors can generate endless URLs. These waste crawl budget and need parameter rules or removal of the links that create them.
- Mixed-signal pages. If your sitemap lists the
http://version while the page redirects tohttps://, the signals disagree. Keep sitemaps, links, and redirects aligned.
Summary of the working model
Search engines see URLs. Any change in scheme, host, path, or query string can create a new URL for the same content. The engine clusters similar URLs and picks one to show. You cannot force that choice, but you can make it predictable by reducing needless variants at the source, redirecting true aliases, and sending consistent signals. The following chapters show how to state your preference with rel="canonical" and how it compares with other tools.
Exercise
Your server returns 200 for all four of these URLs, with identical content: http://example.com/boots, https://example.com/boots, https://www.example.com/boots, and https://www.example.com/boots?utm_campaign=spring. Name the cause of each extra variant, and say which parameters and structural differences you would treat as true duplicates versus separate pages.
Show answer
The variants come from the protocol (http vs https), the host (with and without www), and a tracking parameter (utm_campaign). All four are true duplicates because none changes the content, so they should resolve to one preferred URL, for example https://www.example.com/boots. The first three differences are normally fixed with 301 redirects. The tracking parameter URL usually stays reachable because campaign links need it, so it should carry a canonical hint pointing to the clean URL. A parameter like ?page=2 or ?id=42 would be a separate page, since it selects different content. A filter like ?color=red could be either, depending on whether the filtered view has its own search demand.
Exercise
Why can blocking parameter URLs in robots.txt make a duplicate problem harder to fix?
Show answer
A crawler cannot fetch a blocked URL, so it never reads a redirect or canonical hint on it. The engine cannot consolidate signals from that URL into the preferred one, and the blocked URL can still appear in the index if other pages link to it.