Canonical URLs Explained: Fix Duplicate Addresses on a Small Site
Canonical URLs for small sites: which duplicate addresses cause trouble, when to use a redirect or a rel=canonical tag, and a curl test you can run in ten minutes.
Ask this guide
Answers come straight from this guide’s text. Nothing is generated, and nothing you type leaves your browser.
Your homepage answers at http://example.com, https://example.com, https://www.example.com, and often at a version with a tracking parameter on the end. Every one of those addresses can load the same text. Search engines and AI crawlers then have to guess which address you want shown. The symptoms are familiar: a search result that points at the odd version, two rows for one article in Search Console, or a link that carries ?utm_source= into people's bookmarks.
By the end of this guide you will be able to list every address your site answers on, decide for each one whether it should redirect or point to a canonical address, write the tag correctly, and check the result with a short curl test. The method uses only standard HTTP and HTML, so it works the same on a static site, a CMS, or a hand-built page.
What a canonical URL is, in Google's terms
Google defines canonicalization as "the process of selecting the representative – canonical – URL of a piece of content." Its systems group pages that are the same or nearly the same, choose the one they judge most complete and useful, and show only that one in results. The factors it names are whether a page is served over HTTP or HTTPS, redirects, presence in a sitemap, and rel="canonical" annotations. Google then adds that indicating a preference is "a hint, not a rule" (What is canonicalization).
Two practical consequences follow. First, you do not have to remove every duplicate. Google says some duplicate content is normal and is not a spam violation, and that a site "will likely do just fine" without declaring a canonical preference. Second, when you do declare one, every signal should agree, because Google weighs them together and can still choose a different page.
The duplicates you will probably find
Google's overview lists the common causes: region variants, device variants, protocol variants, site functions such as sorting and filtering, and accidental variants such as a demo copy left open to crawlers. A small site usually has a handful of the same ones. Check your own list in a browser before you change anything.
| Variant | Example | Usual fix |
|---|---|---|
| Protocol | http:// and https:// versions |
Permanent redirect from http to https |
| Host | www. and bare domain |
Permanent redirect to the one you chose |
| Trailing slash | /guide/ and /guide |
Permanent redirect to the form you use in links |
| Tracking parameters | /guide?utm_source=newsletter |
Leave the link working; canonical tag pointing to the clean address |
| Sorting and filtering | /shop?sort=price |
Canonical tag to the default list; decide which filtered views deserve their own page |
| Staging or demo copies | staging.example.com open to crawlers |
Password protection or a block at the server, not a robots.txt rule |
The first four are the ones most small sites have. Work through them in that order, because redirects fix several at once.
Redirect, canonical tag, or sitemap?
Google ranks the methods by how strongly they influence the choice: redirects first, then rel="canonical" annotations, then sitemap inclusion, which it calls a weak signal. The three work best in combination, because Google says the methods "can stack" and that using more than one increases the chance your preferred address appears in results. The table shows which to reach for.
| Situation | Use | Why |
|---|---|---|
| An address should never be served again (http, a second host, a stray slash form) | Permanent redirect (301 or 308) | Strongest signal; visitors land on the right page too |
| The same content must keep working at two addresses (tracking links, filtered views) | rel="canonical" tag in the HTML |
Both addresses stay usable; Google is told which to show |
| A large catalogue where URLs change often | Canonical addresses listed in the sitemap | Simple to maintain; a weaker signal on its own |
| A duplicate in a non-HTML format, such as a PDF | rel="canonical" HTTP header |
Google says the header works for non-HTML files as well |
Google's redirect guidance says permanent redirects tell Google the target should be canonical, and it lists both HTTP 301 and HTTP 308 as permanent options (Redirects and Google Search). Use a permanent redirect only when you are sure it will not be reverted. Google's canonicalization guidance says to use redirects "only when deprecating a duplicate page," so a redirect is the wrong tool for an address you want to keep alive for tracking.
Tip: If a tracking parameter or filter must keep working, do not redirect it away. Keep the URL live and point its canonical tag at the clean page.
Set the canonical tag correctly
Google's guide on specifying a canonical URL gives a short, precise set of rules (How to specify a canonical URL with rel="canonical" and other methods). Follow them in this order.
- Decide the canonical address for each page. Use
https, your chosen host, your chosen trailing-slash form, and no query string. Write it down in a spreadsheet, one row per page. - Put the tag in the
<head>of every duplicate page, pointing at the canonical address. Google only accepts the element in the head section, so check that the head is valid HTML. - Add a self-referential tag to the canonical page too. Google recommends this, so the page names itself as the preferred address.
- Use an absolute URL. Google supports relative paths but does not recommend them, partly because a test copy that gets crawled can then point at itself.
- Choose the HTML tag or the HTTP header, not both. Google says using both is more error-prone, and the two can name different URLs.
- Never point a canonical at a URL fragment such as
#pricing. Google generally does not support fragments as canonicals. - Link to the canonical address inside your site. Consistent internal links show Google which version you prefer.
- Match the sitemap. List the same canonical addresses in
sitemap.xmlthat the tags name.
A correct tag for a guide on this site looks like this:
<head>
<title>What Is llms.txt? The Format, the Evidence, and an Example</title>
<link rel="canonical" href="https://learnhubplay.nl/blog/what-is-llms-txt" />
</head>
Warning: Check the rendered output, not just your template. Google's troubleshooting guidance notes that some content management systems and plugins write wrong canonical tags, and that attackers sometimes inject cross-domain canonicals into compromised sites. Every canonical should point at your own domain.
Test every variant with curl in ten minutes
You can check the server's answer for each address from a terminal. The first command prints the status code and where each address redirects. The second prints the canonical tag the server sends in the HTML. Some servers answer differently to tools that do not identify as a browser, so the commands below send a browser-style user agent.
UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
# 1. Status code and redirect target for each variant
for u in http://example.com/ https://www.example.com/ https://example.com/guide/ "https://example.com/guide?utm_source=test"; do
curl -s -o /dev/null -A "$UA" -w "%{http_code} -> %{redirect_url} (requested: $u)\n" "$u"
done
# 2. The canonical tag the page itself sends
curl -s -A "$UA" https://example.com/guide | grep -o '<link rel="canonical"[^>]*>'
A 200 status with an empty redirect target means the server answered the address directly. A 301 or 308 with a target means it moved, and the target should be your canonical address. If the canonical tag names anything other than the clean address you chose, fix the template.
We ran the same checks on learnhubplay.nl on 3 December 2026. The results:
| Address requested | Result | What it shows |
|---|---|---|
http://learnhubplay.nl/ |
308 to https://learnhubplay.nl/ |
Protocol redirect working |
https://www.learnhubplay.nl/ |
308 to https://learnhubplay.nl/ |
Host redirect working |
https://learnhubplay.nl/blog/what-is-llms-txt/ |
308 to https://learnhubplay.nl/blog/what-is-llms-txt |
Trailing-slash variant redirected to the chosen form |
https://learnhubplay.nl/blog/what-is-llms-txt?utm_source=test |
200; canonical tag is https://learnhubplay.nl/blog/what-is-llms-txt |
Tracking link still works, and the tag names the clean address |
That is one request per address, from one place, on one day. It tells you what the server sends, not what Google has chosen. For that, use the next step.
When Google picks a different page
Google's troubleshooting guide starts with the URL Inspection tool in Search Console, which shows the canonical page Google has selected for a URL (Fix canonicalization issues). Use it on a property you own. If Google's choice differs from yours, work through the guide's steps:
- Look for technical signals first. Check for wrong canonical tags, misconfigured servers returning the wrong site's content, and missing language annotations.
- Make the duplicate pages clearly different. Google says pages in a duplicate cluster can be held there for up to two weeks after you fix content differences, and that clear, significant differences split them out faster.
- Request indexing for your most important URLs only. The Request Indexing feature is subject to quotas, so spend it on the pages that matter most.
Expect slow feedback. A canonical change is a hint that Google re-evaluates over time, not a switch you flip.
Mistakes that send the wrong signal
Some common fixes do the opposite of what people expect.
- Blocking duplicates in robots.txt. Google says not to use robots.txt for canonicalization, because URLs disallowed there may still be indexed without their content.
- Using noindex to choose a canonical. Google does not recommend this within a single site, because noindex blocks the page from Search completely. Use
rel="canonical"for that job. - Using the URL removal tool. Google says not to use it for canonicalization, because it hides all versions of a URL from Search.
- Signals that disagree. A sitemap that lists one address while the tag names another is a conflict. Google says not to specify different canonicals through different techniques.
- Chained redirects. Our advice rather than Google's: point each redirect straight at the final address, so one hop does the job.
Frequently asked questions
Should a page with no copies still carry a canonical link?
Not strictly. Google says a site will likely do fine without specifying a canonical preference. It still recommends a self-referential canonical on every canonical page. The tag costs one line, and it tells Google which address you prefer if a tracking link or a copy appears later.
Will a canonical tag remove the duplicate page from Google?
No. A canonical tag is a hint that asks Google to show the chosen address. Google crawls duplicates less often, but both addresses keep working. If a duplicate should disappear for good, use a permanent redirect when you retire it. Use a canonical when both addresses need to keep working.
What if my sitemap and my canonical tags name different addresses?
Fix it before anything else. Google advises against specifying different URLs as canonical through different techniques. Pick one address for each page and use it in the sitemap, the canonical tag, and the internal links.
How long does Google take to switch to my canonical?
Google's guidance says a duplicate cluster can be held for up to two weeks after you fix the content differences, so give changes that long before deciding they have failed. Use URL Inspection to see the current choice, and request indexing for the handful of pages that matter most.
Sources and further reading
- What is canonicalization - Google Search Central, documentation. Defines canonicalization, lists the duplicate causes, and states that a canonical preference is a hint.
- How to specify a canonical URL with rel="canonical" and other methods - Google Search Central, documentation. Ranks the methods, gives the tag rules, and lists the best practices used in this guide.
- Fix canonicalization issues - Google Search Central, documentation. The URL Inspection workflow, common causes, and the two-week re-evaluation note.
- Redirects and Google Search - Google Search Central, documentation. Permanent versus temporary redirects, and the 301 and 308 codes.
- RFC 9110: HTTP Semantics - IETF, 2022. The standard that defines the HTTP status codes used in the redirect checks.
Where to start this week
- Request the four variants of your homepage and one article, and run the two curl commands above.
- Redirect each variant you do not want to one canonical address.
- Add a self-referential canonical tag to every page template.
- Check that the sitemap lists the same addresses the tags name.
- Use URL Inspection on your two most important pages once the changes have had time to settle.
For the wider picture of what machines read on your site, start with what llms.txt is and whether you need one and the checklist for making documentation readable by AI agents, which also covers one canonical URL per page. If your site publishes structured data, the basics of which Google still supports show how the canonical home page is named in markup. More guides on this subject are on the AI search topic hub.