301 redirects and canonical URLs (or rel="canonical") are two ways to tell search engines which version of a page should be indexed and shown in search results. 301 redirects does a little more than canonical URL’s because in addition to search engines and web crawlers, they also redirect the users to the correct version of a page.
URL canonicalization is a fairly new concept, when compared to 301 redirects. There has been a debate among webmasters on whether canonical URLs produce the same effect and results as 301 redirects do. The answer is both a Yes and a No, but before jumping on to the comparison, let's understand what is actually a 301 redirect and a canonical URL, then we can decide which is best.
What is a 301 Redirect?
Simply put, a 301 redirect is a permanent detour from an old URL to a new one. The new page can be on the same domain or it can also be on a different domain. It is up to the webmaster of a website to decide where he want to redirect a page, image or a file.
If a page on your site has moved from www.domain.com/page.html to www.domain.com/new-page.html, a 301 redirect should be deployed. When you do a server side 301 redirect from the old page to the new one, users will automatically land on the new address, if they enter the old address or click an external/internal link that is pointing to the old address. Additionally, search engines will get the message that your page has now been moved to a new address and they will crawl the page directly from the new location.
301 redirects are particularly useful when you are moving your website from an old domain to a new one, merging two or more websites under a single domain, migrating pages from one sub-domain to another and so forth.
What rel="canonical" Means & When You Should Use It?
A canonical page on the other hand, is the preferred version of a set of pages with highly similar content.
Canonical URLs are deployed to tell search engines that a definite group of pages have the same content and the canonical URL present in the header of each duplicate page, is the version that should be shown on search results. An example will make it more clear.
Let's say you have an ecommerce site, where products may be listed in various order e.g alphabetically, sorted by popularity, sorted by ratings and so on. It is up to the user to choose the sorting mechanism and as a result, three different URLs are produced.
Now, search engines will consider all the above pages a duplicate copy of your main landing page - www.domain.com/mens-clothes.html.
If your site has a large amount of the so called duplicate pages, Google and other search engines would be hesitant to rank it. In the worst case, the search engines might throw a duplicate content penalty on your face and completely remove your site from their index.
The best way to tackle the above situation is to use a canonical URL tag on the head section of each page. Example:
<link rel=”canonical” href="http://www.domain.com/mens-clothes/" />
When search engines see this canonical tag, they will understand that all the three pages are similar and they need not index any of them. Instead, it is the canonical version that should be indexed and shown on search result pages.
301 Redirect or rel="canonical" - Which One Should You Use?
As is usually the case with search engine optimization, there is no straight answer to the above question as it completely depends on your situation and what you want to achieve. Here are several common scenarios:
Case A: You have duplicate versions of the same page (on the same domain), which you don’t want to keep.
Answer: Do a 301 redirect using htaccess.
You would be better off by redirecting the URL of the duplicate pages to their original version because if an external site is linking to any of your duplicate pages, the Page Rank will get carried. Moreover, a user hitting a hyperlink on an external website will automatically land on the correct page, instead of its duplicate version.
Case B: You have duplicate versions of the same page on different domains.
Answer: If you have access to the back end of the website where the duplicate copies are hosted, do a 301 redirect. A 301 redirect is always preferred over a canonical URL, as long as you don't want to keep the duplicate copies.
However, if you do not have access to the back end of the website where the duplicate copies are hosted, go for the canonical URL method. Remember that you have to add the canonical tag on the header of each duplicate page and point the canonical URL to the original page on your domain.
Case C: You have duplicate copies of the same page but you want to keep them for the user.
Answer: For ecommerce or directory sites, it is quite a normal scenario to have a whole bunch of duplicate pages with session ID’s and URL parameters. Here, you don’t want to merge all the duplicates into the main page as the dupes are created by the user and nothing much is in your control. Moreover, your users use the duplicate versions quite often e.g product pages sorted by rating, price and so forth.
Here it makes sense to use the canonical URL tag and tell search engines that the duplicate copies should be ignored.
Cross domain canonicals also work the same way but please keep in mind that you should use the canonical method only when 301 redirect is either not possible or not desired.
In the following video, Google Engineer Matt Cutts makes it very clear that canonical URLs have no special advantage over 301 redirects.