Canonical URL
The one preferred address for a page that's reachable at many, declared so search engines and other tools treat the copies as a single page, a hint introduced by the major search engines together in 2009.
A canonical URL is the preferred address for a page that can be reached at several addresses. A site declares it with a link element in the page's head whose rel attribute is set to canonical, telling search engines which address to show in results and credit with links.
The same page often lives at many addresses without anyone intending it:
- with and without "www," or over both HTTP and HTTPS;
- with and without a trailing slash;
- with tracking parameters appended by newsletters and ads, such as campaign tags;
- with sorting or filtering options in the query string of a shop's category page;
- as a printer-friendly or mobile version;
- as a copy republished on another site.
To a search engine's Web Crawler, each distinct URL is potentially a separate page. Duplicates waste a crawler's limited attention on a site, split incoming links among several versions, and can lead the engine to show an unintended address, such as one with a stranger's tracking code; see Search Engine Optimization.
Google, Yahoo, and Microsoft announced support for the canonical link together in February 2009, a rare joint move among competitors. Search engines treat the declaration as a strong hint, not a command. If the pages differ substantially, or the site's other signals contradict it, the engine may pick a different canonical itself.
Other tools reinforce or replace the hint:
- Permanent redirects send visitors and crawlers from duplicate addresses to the preferred one, and are stronger than a hint where the duplicates have no reason to exist; see HTTP Status Code.
- Consistent internal links point to the preferred address everywhere on the site.
- Sitemaps list only canonical addresses.
- Social previews carry their own preferred address in Open Graph tags, which should agree.
Cross-domain canonicals help syndication. A publisher that lets partners republish an article can ask them to point their copies back to the original, so the original keeps the credit.
The underlying problem is identity: deciding when two things are really the same thing. Databases face it as duplicate records, where one master record is chosen and the others point to it. Good database design avoids storing the same fact twice in the first place. On the web, where anyone can link to any variation of an address, duplicates are inevitable and canonicalization cleans up afterward.
Readable addresses make the preferred version obvious to people, too; see Slug. When pages move, canonical addresses should change with them, or old links will lead nowhere.
See also1
Linked from10
- HotlinkingWeb Platform
Displaying an image or file on your page straight from someone else's server, so they pay for the traffic, which sites block by checking where requests come from and which courts have treated differently from copying.
- HTTP Status CodeWeb Platform
The three-digit number at the start of every HTTP response that tells the client, caches, crawlers and monitoring what happened, grouped into five classes by the first digit.
- Open GraphWeb Platform
The meta tags a page uses to describe its own preview card when a link is shared, how chat apps and social networks fetch them, and why a preview shows only what the page claims about itself.
- Open RedirectWeb Platform
A page that forwards visitors to whatever address a URL parameter names, letting attackers borrow a trusted domain to launch phishing or steal sign-in tokens, and the narrow ways to fix it.
- Search Engine OptimizationData & Content
Making content discoverable through search, most of which is ordinary quality work.
- SitemapData & Content
A list of a website's pages, either drawn for people as a map of its structure or published as an XML file that tells search engines what exists and when it last changed.
- SlugData & Content
The short, readable, hyphenated part of a URL that names a page, borrowed from newsroom jargon, simple to generate and surprisingly hard to keep stable once other people link to it.
- URLWeb Platform
The address format that names every resource on the web, its parts from scheme to fragment, and why parsing one correctly is harder and more security-relevant than it looks.
- Web CrawlerWeb Platform
A program that discovers the web by fetching pages and following their links, the machinery behind search engines and training datasets, and the voluntary etiquette that governs it.
- Web Search EngineWeb Platform
A system that crawls the web, indexes what it finds, and ranks pages in answer to typed queries, the main way people have found things online since the late 1990s and one of the largest advertising businesses ever built.