What is a Canonical URL?
A canonical URL is an HTML link element, with the attribute of rel="canonical" - also known as a canonical tag - found in the <head> section of a web page to designate that this page is the preferred version or URL.
This is particularly relevant when there are multiple URLs that display similar or identical content.
Let's say, you have a web store with a product that can be accessed through multiple URLs like:
Each of these URLs shows the same product, a black laptop, thus leading to duplicate content.
To inform search engines which URL is the primary one, you can choose a canonical URL.
Let's say you select https://www.example.com/products/black-laptop as the canonical URL.
You can then include a canonical link element in the head section of the HTML of the other two pages, like this:
<link rel="canonical" href="https://www.example.com/products/black-laptop" />
This tells search engines that the primary or "canonical" page for this content is https://www.example.com/products/black-laptop, and it should be treated as the primary source of the content.
To better understand canonical URLs, make sure to read our related post about Canonical Tags.