Home Lessons & Videos Site Building Intermediate URL Canonicalization – To www or not to www?

URL Canonicalization – To www or not to www?

Affilorama members only


Watch a preview Join for free

URL Canonicalization – To www or not to www?

2008-10-22 22:27:10

Most people consider www.example.comand example.com to be the same domain name. What most people don't realize is that an address with a www at the start is not the same as an address without a www.

This is why you'll sometimes type an address into your browser and get the "this page doesn't exist" error, but if you add or remove the www the page suddenly springs back into existence. In this lesson, we look at Url Canonicalization - to www or not to www?

What's the difference?

A lot of the time a web server will be configured so that it doesn't really matter what someone types in — they will still get there, so it's not usually such a problem for type-in traffic, but when it comes to the search engines, there's no such luck; they see the two addresses as different, and this can cause problems for website owners using search engine optimization on their websites.

What sort of problems?

Imagine that you'd got yourself a couple of big juicy backlinks. Imagine they're from sites with a PageRank of 7, and they're .edu sites to boot. They're relevant to your topic, they're linking to you using your keywords - it's fantastic!

But now imagine that one is linking to www.yoursite.com, and the other is linking simply to yoursite.com.

Instead of getting a double-whammy of PageRank from these two awesome sites, you're actually only getting half. Half the juice goes to the www address, the other half goes to the non-www address. Imagine that this is happening for ALL of your links - some are going to www, some going to the non-www.

The search engines will only display one version of your site in the search listings, so it's not like you have two chances to win - you're actually losing the benefit of half your links.

The Fix

There are a couple of things you can do to ensure that all your link love is being funneled to the right place:

  • Pick a version of your address and stick with it.
    The best way to choose www or non-www is to type each page into your browser in turn and see which one has the highest PageRank. This is an indicator of the number and strength of backlinks to that version of your page.

    You can also use a tool like Traffic Travis to check the number and quality of backlinks to each version of your domain. If you've got a brand new domain, or if both versions of your site are ranking pretty much the same, then just pick whichever version you like best. Then make sure you stick with it! Try to get your link partners to stick with it as well.

  • Set your preferred address in Google's Webmaster Tools
    Google let you designate your preferred address in their Webmaster Tools site. If you haven't signed up for Webmaster Tools you should probably do so — there's a few other useful tools in there that will come in handy eventually.

  • Do a 301 redirect (moved permanently) in your .htaccess file
    Copy the following snippet of text into your .htaccess file

    To turn non-www into a www

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{http_host} ^yourdomain.com [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/ [R=301,NC]

    To turn www into a non-www

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{http_host} ^www\.yourdomain\.com [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/ [R=301,NC] 

Lesson Summary

In this lesson we took a look at how to stop losing PageRank from a non-canonicalized Domain Name! Three methods we looked at to reduce or even fix the issue were:

  • Pick a version of your address and stick with it
  • Set your preferred address in Google Webmaster Tools
  • Use a RewriteRule in your .htaccess file


Learn something new? Share it with your friends!


Questions & Comments + Add a comment

Reply naghashisakhteman
But technically all of these urls are different. A web server could return completely different content for all the urls above. When Google “canonicalizes” a url, we try to pick the url that seems like the best representative from that set.
Kate Walls
You can adjust them from Search Console and Google will treat your both URL as single.
Reply sam singh
Well, nice concepts and knowledge behind this canonical process. As its very necessary these days and everyone is redirecting their page to the desired page which they allow google to index and display on SERP.Thanks
  • Anatomy of a Web Page #2 In this lesson we're going to look at a few more elements that make up your average web page, as well as a brief intr...
  • How to hide your affiliate link with ... Affiliate links are ugly, and can sometimes put people off clicking them. In this lesson we look at making your links...
  • Simplifying Navigation with PHP Includes Websites with more than one page can be a pain to update. However, 'PHP includes' allow you to change multiple pages ...
  • Date Scripts What better way to get your visitors to act now than to give them a deadline? "Act now! This offer expires tomorrow!"...
  • Sitemaps When you become desperate to find a particular page on a site, you need to refer to the sitemap. Learn what it does, ...
  • How to Move Your Pages With 301 Redir... If you've got a page on your affiliate site that's doing well, but you want to move its location without losing any t...
  • Robots.txt - Telling the search engin... To index your site, search engines send spiders to crawl all your content to check for relevant information. But what...
  • How to create a rollover button In this lesson we'll be explaining the steps involved in creating a rollover button and how to add it to a page on yo...

Don't forget to follow us!

More topics

Essential Resources Every New Affilia... New to affiliate marketing? Not sure what it's all about? Then let us get you started!
Affiliate Outsourcing No one person can do everything on their own. Learn how to reduce (or even eliminate!) your workload with outsourcing.
Site Building As an affiliate, chances are you'll end up building a website or two. Here's your basic quickstart!
Marketing Ideas Needing inspiration? Wanting to go outside the box? Take a look in here for your next few marketing ideas!
Market Research for Affiliate Marketers To be a successful affiliate you must learn how to research their market before dedicating your precious time.
Pay Per Click Pay-per-click is one major method affiliates use to get traffic. Learn what it is and how you can use it effectively!
Search Engine Optimization Search engine optimization (SEO) is a major way of getting traffic to your site at minimal cost! Learn how to put it ...
Content Creation This section is all about content: How to write it, how to get it written for you, and other useful goodies!