Stay organized with collections Save and categorize content based on your preferences.
How to specify a canonical URL with rel="canonical" and other methodsTo specify a canonical URL for duplicate or very similar pages to Google Search, you can indicate your preference using a number of methods. These are, in order of how strongly they can influence canonicalization:
rel="canonical"
link
annotations: A strong signal that the specified URL should become canonical.Keep in mind that these methods can stack and thus become more effective when combined. This means that when you use two or more of the methods, that will increase the chance of your preferred canonical URL appearing in search results.
While we encourage you to use these methods, none of them are required; your site will likely do just fine without specifying a canonical preference. That's because if you don't specify a canonical URL, Google will identify which version of the URL is objectively the best version to show to users in Search.
If you use a CMS, such as WordPress, Wix, or Blogger, you might not be able to edit your HTML directly. Instead, your CMS might have a search engine settings page or some other mechanism to tell search engines about the canonical URL. Search for instructions about modifying the<head>
of your page on your CMS (for example, search for "wordpress set the canonical element"). Reasons to specify a canonical URL
While it's generally not critical to specify a canonical preference for your URLs, there are a number of reasons why you would want to explicitly tell Google about a canonical page in a set of duplicate or similar pages:
https://www.example.com/dresses/green/green-dress.html
rather than https://example.com/dresses/cocktail?gclid=ABCD
.https://example.com/dresses/cocktail?gclid=ABCD
get consolidated with links to https://www.example.com/dresses/green/green-dress.html
if the latter becomes canonical.For all canonicalization methods, follow these best practices:
rel="canonical"
).noindex
to prevent selection of a canonical page within a single site, because it will completely block the page from Search. rel="canonical"
link
annotations are the preferred solution.hreflang
elements, make sure to specify a canonical page in the same language, or the best possible substitute language if a canonical page doesn't exist for the same language.The following table compares the different canonicalization methods, highlighting their strengths and weaknesses when it comes to maintenance and efficacy in different scenarios.
Method and descriptionrel="canonical" link
element
Add a <link>
element in the code for all duplicate pages, pointing to the canonical page.
rel="canonical"
HTTP header.rel="canonical"
HTTP header
Send a rel="canonical"
header in your page response.
Specify your canonical pages in a sitemap.
Pros:
Cons:
rel="canonical"
mapping technique.rel="canonical"
link
annotations
Google supports explicit rel
canonical link
annotations as described in RFC 6596. rel="canonical"
annotations that suggest alternate versions of a page are ignored; specifically, rel="canonical"
annotations with hreflang
, lang
, media
, and type
attributes are not used for canonicalization. Instead, use the appropriate link
annotations to specify alternate versions of a page; for example, link
rel="alternate"
hreflang
for language and country annotations.
You can provide the rel="canonical"
link
annotations in two ways:
We recommend that you choose one of these and go with that; while supported, using both methods at the same time is more error prone (for example, you might provide one URL in the HTTP header, and another URL in the rel="canonical"
link
element).
rel="canonical"
link
element
A rel="canonical"
link
element (also known as a canonical element) is an element used in the head
section of HTML to indicate that another page is representative of the content on the page.
Suppose you want https://example.com/dresses/green-dresses
to be the canonical URL, even though a variety of URLs can access this content. Indicate this URL as canonical with these steps:
<link>
element with the attribute rel="canonical"
to the <head>
section of duplicate pages, pointing to the canonical page. For example:
<html> <head> <title>Explore the world of dresses</title> <link rel="canonical" href="https://example.com/dresses/green-dresses" /> <!-- other elements --> </head> <!-- rest of the HTML -->
rel="alternate"
link
element to it, pointing to the mobile version of the page:
<html> <head> <title>Explore the world of dresses</title> <link rel="alternate" media="only screen and (max-width: 640px)" href="https://m.example.com/dresses/green-dresses"> <link rel="canonical" href="https://example.com/dresses/green-dresses" /> <!-- other elements --> </head> <!-- rest of the HTML -->
hreflang
or other elements that are appropriate for the page.Use absolute paths rather than relative paths with the rel="canonical"
link
element. Even though relative paths are supported by Google, they can cause problems in the long run (for example, if you unintentionally allow your testing site to be crawled) and thus we don't recommend them.
Good example: https://www.example.com/dresses/green/green-dress.html
Bad example: /dresses/green/green-dress.html
The rel="canonical"
link element
is only accepted if it appears in the <head>
section of the HTML, so make sure at least the <head>
section is valid HTML.
If you use JavaScript to add the rel="canonical"
link
element, make sure to inject the canonical link element properly.
If you can change the configuration of your server, you can use a link
HTTP response header with a rel="canonical"
target attribute as defined by RFC5988 rather than an HTML element to indicate the canonical URL for a document supported by Search, including non-HTML documents such as PDF files.
Google supports this method for web search results only.
If you publish content in many file formats, such as PDF or Microsoft Word, each on their own URL, you can return a rel="canonical"
HTTP header to tell Googlebot what is the canonical URL for the non-HTML files. For example, to indicate that the PDF version of the .docx
version should be canonical, you might add this HTTP header for the .docx
version of the content:
HTTP/1.1 200 OK Content-Length: 19 ... Link: <https://www.example.com/downloads/white-paper.pdf>; rel="canonical" ...
As with the rel="canonical"
link
element, use absolute URLs in the rel="canonical"
HTTP header.
Pick a canonical URL for each of your pages and submit them in a sitemap. All pages listed in a sitemap are suggested as canonicals; Google will decide which pages (if any) are duplicates, based on similarity of content.
Supplying the preferred canonical URLs in the sitemaps is a simple way of defining canonicals for a large site, and sitemaps are a useful way to tell Google which pages you consider most important on your site.
Use redirectsUse this method when you want to get rid of existing duplicate pages. All redirection methods —301
and 302
redirects, meta-refresh
, JavaScript redirects—have the same effect on Google Search, however the time it takes for search engines to notice the different redirect methods may differ.
For the quickest effect, use 3xx
HTTP (also known as server-side) redirects.
Suppose your page can be reached in multiple ways:
https://example.com/home
https://home.example.com
https://www.example.com
Pick one of those URLs as your canonical URL, and use redirects to send traffic from the other URLs to your preferred URL.
Other signalsApart from explicitly provided methods, Google also uses a set of canonicalization signals that are generally based on site setup: preferring HTTPS over HTTP, and URLs in hreflang
clusters.
Google prefers HTTPS pages over equivalent HTTP pages as canonical, except when there are issues or conflicting signals such as the following:
rel="canonical"
link
to the HTTP page.Although our systems prefer HTTPS pages over HTTP pages by default, you can ensure this behavior by taking any of the following actions:
rel="canonical"
link
from the HTTP page to the HTTPS page.To prevent Google from incorrectly making the HTTP page canonical, avoid the following practices:
hreflang
annotations rather than the HTTPS version.example.com
serving the certificate for subdomain.example.com
. The certificate must match your complete site URL, or be a wildcard certificate that can be used for multiple subdomains on a domain.hreflang
clusters
To help with sites' localization efforts, for canonicalization purposes Google prefers URLs that are part of hreflang
clusters. For example, if https://example.com/de-de/cats
and https://example.com/de-ch/cats
reciprocally point to each other with hreflang
annotations, but not to https://example.com/de-at/cats
, the pages for de-de
and de-ch
will be preferred as canonicals instead of the /de-at/
page that doesn't appear in the hreflang
cluster.
Read more about troubleshooting and fixing canonicalization issues.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3