Mobile app version of vmapp.org
Login or Join
Mendez628

: What is the difference between canonical and 301 redirects? I am not able to differentiate between canonical and 301 Redirects. The canonical link and 301 redirects have been around for years,

@Mendez628

Posted in: #301Redirect #CanonicalUrl #RelCanonical

I am not able to differentiate between canonical and 301 Redirects.

The canonical link and 301 redirects have been around for years, but they continuously generate the confusion and questions about which is the best solution to manage the redirection.

So, can you elaborate the general problems with 301 redirects and canonical option?

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Mendez628

4 Comments

Sorted by latest first Latest Oldest Best

 

@Courtney195

The TL;DR answer:

301 redirect - Tech version of "Hello, I no longer use /requested-url, instead I use /this-new-url. Please update your information accordingly."

Canonical - Say to the bots: "Hi. For this page, I prefer /this-url as url. If you've indexed this page with another url, please disregard that one and use this one.

10% popularity Vote Up Vote Down


 

@Bryan171

A canonical tag and a 301 redirect are two very different things.

A <link href="...." rel="canonical" /> tag basically tells search engines "if someone is looking for the content on this page, use the URL ...".

A 301 redirect tells search engines AND browsers "Hey, the page you're looking for has moved permanently to the URL at ....".

Consider you have a product page at example.com/product.php and it's available in 3 different colors, blue, black, and red. Let's say that when the user selects a color, the page refreshes to show an image of the hat in the color they've chosen, and to do so the URL changes to example.com/product.php?color=blue so that the page knows which color image to show.

Now, when a search bot comes along, it will see 4 URLs for that page, example.com/product.php, example.com/product.php?color=blue, example.com/product.php?color=black, example.com/product.php?color=red. Google does not know that these are "varations" of the same page, it assumes each is a seperate page, because each has a unique URL. And when it crawls those 4 pages, it will see that the content doesn't change (except for the image). It see's that the content on all 4 pages is basically identical, and thus categorize them as "duplicate content".

To solve this problem, you specify a canonical URL in the product.php's <head> to tell Google that example.com/product.php is the page that Google should send users to. For this to be implemented correctly, the canonical in each of the "variations" should also point to the same URL, not the URL of the variation.

Now, from a strictly SEO/bot perspective, you could use 301 redirects to accomplish the same thing. Anytime Googlebot would come by to visit one of your variation pages (example.com/product.php?color=blue), your server would tell Googlebot that that page has moved permanently to example.com/product.php, and Google would eventually de-index the variation pages and only keep the "main" product.php page in it's index.

The problem however comes when actual users would visit the page. Because browsers follow 301 redirects, and not canonical URLs, everytime a user came to that page and tried to select a color to see the nice hat in red by going to example.com/product.php?color=red, your server would return a 301 redirect to example.com/product.php, and your browser would go to that URL. As you can see, the problem is that the user would never actually be able to see any of the variation pages.

Another way to think of it is that the canonical tag is a "suggestion", while the 301 redirect is more of an "order". Browsers and bots will both always follow 301 redirects. Bots will use the canonical to determine which URLs to index, and which to ignore. Your browser typically will ignore the canonical as irrelevant to it's job.

10% popularity Vote Up Vote Down


 

@Angela700

One thing that makes the difference between a canonical labeled page and a 301 redirect is the initial HTML code you see.

Say you have these two URLs:
example.com/duplicate http://example.com/original


...and you use a 301 redirect from the first URL to the second.

If you analyze the results in something other than an ordinary web browser, you should see a page that tells you the page has moved with the word "here" as a hyperlink to the new page, or something similar.

I use the command-line tool CURL to test some pages, and on the redirect pages, the following HTML is shown:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://example.com/newurl">here</a>.</p>
</body></html>


Also, I ran CURL -I to see the headers of the redirect, and the output is:

HTTP/1.1 301 Moved Permanently
Date: Sat, 30 May 2015 17:47:32 GMT
Server: Apache
Location: example.com/newurl Content-Type: text/html; charset=iso-8859-1


As for the pages labeled as canonical, you will never see the moved status code or the moved page message like above.

Each way has its pros and cons.

If you use canonical, the advantage is that there may be fewer requests to the server because two pages are duplicate and theres little chance one will look at the other duplicate page especially if its not advertised in any sitemap submitted to any search engine.

The disadvantage is that rel=canonical might be something some search engines still do not understand and therefore, your ranking could be affected for those search engines. Also, if the contents of the affected pages change to the point where two pages are no longer duplicate or related, then using rel=canonical might work against you depending on how google perceives it.

The way I prefer to do it is via the 301 redirect.

The advantage with 301 is that users get moved to the correct page and the URL in the clients web browser is updated to display the new URL instead of the old one. Also, all search engines in the world will be happy with this method since 301 redirects are not something new like rel=canonical is.

The drawback is that an extra request is required to complete the redirect and in normal web browsers, the request is often automatic because most people don't like seeing messages like "the document has moved here".

Having weighed everything, I personally would continue with 301 redirects and optimize my server to make the latency to a minimum. On a well optimized server, serving the first byte of a page locally with a 301 redirect served should take no more about 400 milliseconds.

10% popularity Vote Up Vote Down


 

@Lee4591628

When you use 301 redirect, you show to Google that current page it's permanently moved to another url.

Cannonical is used to prevent penalties by Google for duplicate content. When you use it, the current page exists but shows to google that is "copy" of another "master page" For example I can give you OpenCart product urls, they are like this:

domain.com/product-1
domain.com/category-1/product-1
domain.com/category-1/subcategory-1/product-1


This is 3 exact same pages with equal content and Google doesn't like duplicate content like this.
So in this case you should put in every single page a rel canonical tag to the "master" page. For example we will chose "domain.com/category/subcategory/product:

<link rel="canonical" href="domain.com/category/subcategory/product">


OpenCart doing this by default, but I'm just using it for the example.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme