Use canonical URLs

Set a preferred URL for your content

This article describes how you can use canonical URLs to improve link and ranking signals for content available through multiple URL structures or via syndication.

In the world of content management and online shopping systems, it's common for the same content to be accessed through multiple URLs. With content syndication, it's also easy for content to be distributed to different URLs and domains entirely. For example:

The same product page has dynamic URLs as a result of user session and/or search preference.
http://www.example.com/products?category=dresses&color=green

http://example.com/dresses/cocktail?gclid=ABCD 

http://www.example.com/dresses/green/greendress.html
Your blog system automatically saves multiple URLs as you position the same post under multiple sections.
http://blog.example.com/dresses/green-dresses-are-awesome/

http://blog.example.com/green-things/green-dresses-are-awesome/
Your server is configured to serve the same content for the www subdomain or the https protocol.
http://example.com/green-dresses

https://example.com/green-dresses

http://www.example.com/green-dresses
Content you provide on that blog for syndication to other sites is replicated in part or in full on those domains.
http://news.example.com/green-dresses-for-every-day-155672.html (syndicated post)

http://blog.example.com/dresses/green-dresses-are-awesome/3245/ (original post)

While these systems make it more convenient to develop and distribute content, they cause some challenges when people use search engines to reach your page. For instance:

  • Consolidating link signals for the duplicate or similar content. It helps search engines to be able to consolidate the information they have for the individual URLs (such as links to them) on a single, preferred URL. This means that links from other sites to http://example.com/dresses/cocktail?gclid=ABCD get consolidated with links to http://www.example.com/dresses/green/greendress.html.
  • Tracking metrics for a single product/topic. With a variety of URLs, it's more challenging to get consolidated metrics for a specific piece of content.
  • Determining the URL you want people to see. You prefer people reach your green dresses product page via http://www.example.com/dresses/green/greendress.html rather than http://example.com/dresses/cocktail?gclid=ABCD.
  • Addressing syndicated content. If you syndicate your content for publication on other domains, you want to consolidate page ranking to your preferred URL.

To address these issues, we recommend you define a canonical URL for content (or equivalent content) available through multiple URLs. You can do this for Google Search in a number of ways:

While we encourage you to use any of these methods, none of them are required. If you don't indicate a canonical URL, we'll identify what we think is the best version or URL.

Don't use the robots.txt file for canonicalization purposes.
Don't use the URL removal tool for canonicalization: it removes all versions of a URL from search.
Don't specify different URLs as canonical for the same page (e.g. one URL in a sitemap and a different URL for that same page using rel="canonical").

Set your preferred domain

Tell Google which version of your site's URL you prefer for your domain:

  • http://www.example.com
  • http://example.com

If you set your preferred domain as http://example.com, Google treats links to http://www.example.com exactly the same as links to http://example.com.

Read Set your preferred domain for details.

Indicate the preferred URL with the rel="canonical" link element

Suppose you want http://blog.example.com/dresses/green-dresses-are-awesome/ to be the preferred URL, even though a variety of URLs can access this content. You can indicate this to search engines as follows:

  • Mark up the canonical page and any other variants with a rel="canonical" link element.
    Add a <link> element with the attribute rel="canonical" to the <head> section of these pages: 
    <link rel="canonical" href="http://blog.example.com/dresses/green-dresses-are-awesome" />

    This indicates the preferred URL to use to access the green dress post, so that the search results will be more likely to show users that URL structure. (Note: We attempt to respect this, but cannot guarantee this in all cases.)

Avoid errors: use absolute paths rather than relative paths with the rel="canonical" link element.

Use this structure:  http://www.example.com/dresses/green/greendresss.html
Not this structure: /dresses/green/greendress.html).

Use a sitemap to indicate preferred URLs for the same content

Pick a canonical (preferred) URL for each of your pages, and tell us about your preference by submitting these canonical URLs in a sitemap.

We don't guarantee that we'll use the URLs you submit in a sitemap, but submitting one is a useful way to tell Google about the pages on your site you consider most important.

Use 301 redirects for URLs that are not canonical

Suppose your page can be reached in multiple ways:

  • http://example.com/home
  • http://home.example.com
  • http://www.example.com

It's a good idea to pick one of those URLs as your preferred (canonical) destination, and use 301 redirects to send traffic from the other URLs to your preferred URL. A server-side 301 redirect is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location.

Indicate how to handle dynamic parameters

Use Parameter Handling to tell Google about any parameters you would like ignored. Ignoring certain parameters can reduce duplicate content in Google's index, and make your site more crawlable. For example, if you specify that the parameter sessionid should be ignored, Google will consider http://www.example.com/dresses/green.php?sessionid=273749 to be the same as http://www.example.com/dresses/green.php.

Specify a canonical link in your HTTP header

If you can configure your server, you can use rel="canonical" HTTP headers to indicate the canonical URL for HTML documents and other files such as PDFs. Say your site makes the same PDF available via different URLs (for example, for tracking purposes), like this:

http://www.example.com/downloads/white-paper.pdf
http://www.example.com/downloads/partner-1/white-paper.pdf
http://www.example.com/downloads/partner-2/white-paper.pdf
http://www.example.com/downloads/partner-3/white-paper.pdf

In this case, you can use a rel="canonical" HTTP header to specify to Google the canonical URL for the PDF file, as follows:

Link: <http://www.example.com/downloads/white-paper.pdf>; rel="canonical"

Google currently supports these link header elements for Web Search only.