Sub topic 12
Choosing the right canonical URL
This chapter assumes you know what rel=canonical is, how URL variants arise (query strings, protocol, host, trailing slashes), and how HTTP status codes work. Here you will learn how to pick the one URL that every variant should point to.
What a canonical target must be
The canonical is the version of a page you want search engines to index and show. Search engines treat your choice as a hint, not a command. They compare it with other signals and may choose a different URL. Your goal is to pick a target that all your signals agree on.
A good canonical target meets these conditions:
- It returns a 200 status. A redirect, 404, or blocked page is a poor target.
- It is indexable. It has no
noindexand is not disallowed in robots.txt. - It is the version users should land on, with the full content.
- It is an absolute URL, including protocol and host.
Rules for choosing among variants
- Protocol. Choose HTTPS. Redirect HTTP to HTTPS and canonicalize to HTTPS.
- Host. Choose either
wwwor the bare domain and use it everywhere. The choice matters less than consistency. - Trailing slash and case. Pick one convention for the whole site. URLs are case-sensitive in the path, so
/Shoesand/shoescount as different URLs. - Tracking parameters. Remove
utm_*,gclid, and similar parameters. They do not change content. - Content parameters. Keep parameters that change what the page shows, such as
?page=2or?category=boots, if each result deserves to be found in search. - Sort and filter parameters. Point
?sort=priceto the unsorted page. It shows the same items in a different order. - Fragments. Drop everything after
#. Search engines ignore fragments for indexing.
Pagination is a special case. Page 2 of a list shows different items from page 1, so it should canonicalize to itself. Pointing every page at page 1 hides the items on later pages.
A decision flow
Example
Suppose these URLs show the same product list:
http://example.com/shoes/trail?utm_source=mailhttps://www.example.com/shoes/trail/?sort=pricehttps://www.example.com/shoes/trail
Your site uses HTTPS, www, and no trailing slash. The canonical for all three is the last one. Place this in the head of each variant:
<link rel="canonical" href="https://www.example.com/shoes/trail">The target page should also carry a self-referencing canonical, which points to its own URL. This protects it if new parameters appear later.
Keep every signal consistent
Search engines weigh internal links, sitemap entries, redirects, and canonicals together. If your sitemap lists the HTTP version but the canonical says HTTPS, you have sent conflicting signals. Make internal links, sitemap URLs, and canonical tags all use the same URL.
Common errors
- Canonicalizing to a URL that redirects, which creates a chain.
- Using relative URLs, which can resolve against the wrong host.
- Pointing many different pages at the home page.
- Canonicalizing to a page that is
noindex.
Exercise
A category page at https://www.example.com/boots?page=3 shows items 41–60. A developer sets its canonical to https://www.example.com/boots. What is wrong, and what should the canonical be?
Show answer
Page 3 lists different items from page 1, so pointing it at page 1 hides those items from search engines. The canonical should point to itself: https://www.example.com/boots?page=3.