Canonical URL: Canonical URL (uniform resource locator) is a term used to describe a preferred web address by a domain. Many webmasters will set a canonical URL in their page's coding in order to specify which address a search engine will index, so as to not get penalized for having duplicate content on the web. It is also referred to as a canonical link element.
For example, a website may set a preference for which version of their homepage a search engine like Google should index. Instead of using www.example.com, a webmaster may set the canonical URL as www.example.com/index.php. This helps to provide the most authoritative and accurate version of a website for search engines to index (i.e. crawl and save to display as a search result).
Although Google is harsh in penalizing websites that display duplicate content in an effort to prevent search results from being spammed, Webmaster Guidelines state that canonical URLs are more like a hint to the web crawler rather than a strict rule. Duplicate content, according to Google, is any information that is exactly the same but displayed on multiple URLs. Using 301 redirects to set a preferred URL, however, is permitted and sometimes even considered better than using a canonical URL setting.
Coding for the canonical link element goes into the < head > section of a site's code. An example of the code may look something like:
< link rel="canonical" href="https://example.com/" / >