Canonical link element
A canonical link element is an HTML element that helps webmasters prevent duplicate content issues in search engine optimization by specifying the "canonical" or "preferred" version of a web page. It is described in RFC 6596, which went live in April 2012. Purpose. A major problem for search engines is to determine the original source for documents that are available on multiple URLs. Content duplication can happen in many ways, including: Duplicate content issues occur when the same content is accessible from multiple URLs. For example, would be considered by search engines to be an entirely different  page from , even though both URLs may reference the same content. In February 2009, Google, Yahoo and Microsoft announced support for the codice_1 link element, which can be inserted into the section of a web page, to allow webmasters to prevent these issues. The canonical link element helps webmasters make clear to the search engines which page should be credited as the original. How search engines handle codice_2. Search engines try to utilize canonical link definitions as an output filter for their search results. If multiple URLs contain the same content in the result set, the canonical link URL definitions  will likely be incorporated to determine the original source of the content. "For example, when Google finds identical content instances, it decides to show one of them. Its choice of the resource to display in the search results will depend upon the search query." According to Google, the codice_1 link element is not considered to be a directive, but rather a hint that the ranking algorithm will "honor strongly." While the canonical link element has its benefits, Matt Cutts, then the head of Google's webspam team, has said that the search engine prefers the use of 301 redirects. Cutts  said the preference for redirects is because Google's spiders can choose to ignore a canonical link element if they deem it more beneficial to do so. Implementation. Semantic tag. The canonical link element can be either used in the semantic HTML or sent with the HTTP header of a document. For non HTML documents, the HTTP header is an alternate way to set a canonical URL. By the HTML 5 standard, the <link rel="canonical" href="http://example.com/"> HTML element must be within the section of the document. Self-hyperlink. Some sites such as Stack Overflow have on-page hyperlinks  which link to a clean URL of themselves. Usability benefits are facilitating copying the hyperlink target URL or title if the browser or a browser extension offers a "Copy link text" context menu option for hyperlinks, the ability for the original URL to be retrieved from a saved page if not stored by the browser into a comment inside the file, as well as the ability to duplicate the opened page into a new tab right next to the currently opened one if the browser lacks such a feature. Examples. HTML. Below is an example of HTML code that uses  the inside the tag. The code could be used on a page such as https://example.com/page.php?parameter=1to tell search engines that the https://example.com/page.php is the preferred version of the webpage. <!DOCTYPE html> <html> <head> </head> <body> </body> </html> HTTP. HTTP/1.1 200 OK Content-Type: application/pdf Link: <https://example.com/page.php>; rel="canonical" Content-Length: 4223