What is Canonical URL?
A canonical URL is the preferred version of a web page when multiple URLs serve similar or identical content. The rel='canonical' tag tells search engines which version to index and rank.
Duplicate content is common: product pages accessible via multiple categories, pages with URL parameters (sorting, filtering), HTTP vs HTTPS versions, www vs non-www versions. Without canonical tags, search engines must guess which version to rank — and they often guess wrong.
Implementation: Add <link rel='canonical' href='https://example.com/preferred-page'> to the HTML head of all versions. Self-referencing canonicals (pointing to themselves) on unique pages are also best practice.
Example
An ecommerce product accessible at /shoes/nike-air-max and /sale/nike-air-max should have a canonical pointing to the primary URL (usually the non-sale category URL).