Many sites make the same HTML content or files available via different URLs. Say you have a clothing site and one of your top items is a green dress. The product page for the dress may be accessible through several different URLs, especially if you use session IDs or other parameters:
http://www.example.com/products/women/dresses http://www.example.com/products?category=dresses&color=green&cruel=no http://example.com/shop/index.php?product_id=32&highlight=green+dress&cat_id=1&sessionid=123&affid=431 http://example.com/dresses/cocktail?gclid=ABCD http://www.example.com/dresses/greendress.html
To gain more control over how your URLs appear in search results, and to consolidate properties, such as link popularity, we recommend that you pick a canonical (preferred) URL as the preferred version of the page. You can indicate your preference to Google in a number of ways. We recommend them all, though none of them is required (if you don’t indicate a canonical URL, we’ll identify what we think is the best version). We do not recommend using the robots.txt file for canonicalization purposes.
- Set your preferred domain
- Specify the canonical link for each version of a page
- Use 301 redirects
- Indicate your canonical (preferred) URLs by including them in a Sitemap
- Indicate how you would like Google to handle dynamic parameters
- Specify a canonical link in your HTTP header
Set your preferred domain
Setting your preferred domain tells Google which version of your site’s URL (http://www.example.com or http://example.com) you prefer.
If you set your preferred domain as http://example.com, we’ll treat links to http://www.example.com exactly the same as links to your preferred domain.
To set the preferred domain for a site, click Configuration, and then click Settings. In the Preferred domain section, pick the option you prefer.
Specify the canonical link for each version of the page
If you want http://www.example.com/dresses/greendress.html to be the canonical URL for your listing, you can indicate this to search engines by adding a
<link> element with the attribute
rel="canonical" to the <head> section of the non-canonical pages. To do this, create a link as follows:
<link rel="canonical" href="http://www.example.com/dresses/greendress.html">
Add this extra information to the
<head> section of non-canonical URLs.
This tells Google that these URLs all refer to the canonical page at http://www.example.com/dresses/greendress.html. Note: We recommend using a link with the attribute
rel="canonical" to indicate your preferred URL, but we can’t guarantee to follow that preference in all cases.
Use 301 redirects
If a page can be reached in multiple ways—for instance, http://example.com/home, http://home.example.com, or 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.
To implement a 301 redirect for websites that are hosted on servers running Apache, you’ll need access to your server’s .htaccess file. (If you’re not sure about your access or your server software, check with your webhoster.) For more information, consult the Apache .htaccess Tutorial and the Apache URL Rewriting Guide. If your site is hosted on a server running other software, check with your hoster for more details, or check out this article.
Indicate your canonical (preferred) URLs by including them in a Sitemap
Pick a canonical (preferred) URL for each of your product 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.
Indicate how you would like Google 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.htm?sessionid=273749 to be the same as
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.