7

Do you know if I should use <link rel="canonical" tag, or 301 redirect from:

http://example.com to http://www.example.com

...to avoid a duplicate content penalty in case other pages link to the domain without the www subdomain? Or is Google smart enough now to identify which is the canonical one?

11

If you don't specifically tell Google your preference you will probably have duplicate content issues. There is more then one way to inform Google of your preferred domain:

  1. Do a 301 redirect to use the 'www' or no 'www'
  2. Specify your preferred domain in Google Webmaster Tools
  3. Use canonical URLs (although it isn't typically used in this situation)
  • 2
    I'd choose solution (1) ;) – Olivier Pons Nov 19 '11 at 16:20
2

John's answer is spot on however if your looking for advice which one is technically the best then the actual the answer is all 3 options.

SOURCE: Pro Webmasters Answer from John Conde

  1. Do a 301 redirect to use the 'www' or no 'www'
  2. Specify your preferred domain in Google Webmaster Tool
  3. Use canonical URLs (although it isn't typically used in this situation

And here's why...

Why 301 redirect URLs:

When you force users to use either www or non-www and they decide to reward your site with a backlink the next user who clicks that link does not need to go through a redirect.

While redirects nowadays are near instant they are additional server-side request that can be reduced if you have users linking to you correctly, which should be considered a good practice, especially if your site receives high volume of traffic.

Why canonical URLs

Nowadays it is considered a best practice to use canonical links, this is because duplicate content can appear in many different forms without factoring www and non-www. Blogs particularly will operate with pages being accessible via many different URLS for example:

  • /date/
  • /tag/
  • /author/

Using Canonical links correctly will insure that your content however it may be accessed is never marked as duplicate.

Why preferred domain in Google Console

It is a good practice to add all variations to Google Webmaster Tools so that you can confirm at any point that your site or Google is not doing anything it shouldn't be.

  • NON-SSL sites will have 2 variations
  • SSL sites will have 4 variations

You should seem something similar to this:

bybe multiple sites in webmaster tools

Adding a preferred domain in the process takes no more than a few seconds but in additional to 301 and canonicals this option is a great fallback just in case for some reason your 301's or canonical links stop working for one reason or more.

  • 1
    "301 redirects result in around a 15% loss of PageRank" is untrue. Matt Cutts said he made that up because somebody suggested that they redirect rather than use links. See Google: PageRank Dilution Through A 301 Redirect Is A Myth and then Google: There is no PageRank dilution when using 301, 302, or 30x redirects anymore – Stephen Ostermiller Oct 31 '16 at 18:18
  • I believe that Matt Cutts was referring the the "pagerank damping factor" (See en.wikipedia.org/wiki/PageRank) when referring to the 15%. He either believed that it applied to during redirects, or said it did because it helped make his case not to do something shady. Google has now said redirecting URLs do not have the damping factor applied to them (even if they did at some point.) – Stephen Ostermiller Oct 31 '16 at 18:23
  • Good find, since I'm unable to back that up with fact I've removed it from the answer. I do however believe this is untrue, it would be fair to say a lot of what Google tells us is disinformation, Matt Cutts and John.M response is to Gary's tweet was purposely vague to say the least. – Simon Hayter Oct 31 '16 at 20:38
  • "...reward your site with a backlink the next user who clicks that link does need to go through a redirect." - Although if you have the redirect in place then the correct link will most likely have already been copied to create the backlink in the first place, so the "next user" will click the already canonicalised backlink and not need to be redirected. – MrWhite Nov 1 '16 at 9:06
  • Suppose say DOES NOT need to go through a redirect, that was the benefit of enforcing urls. – Simon Hayter Nov 1 '16 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.