Did you know that the adress “http://mysite.com” and “http://www.mysite.com” are treated differently by the search engines because it thinks they are different?
This has to do with something called canonicalization.
Canonicalization what??
Well googles sais like this about it what canonicalization is: “Sorry that it’s a strange word; that’s what we call it around Google. Canonicalization is the process of picking the best url when there are several choices, and it usually refers to home pages."
So what he means for example, consider the following urls:
- www.example.com
- example.com/
- www.example.com/index.html
- example.com/home.asp
They may look like they are linking to the same adress, but they are not. Google also punishes for having the same content on several places, because it is not relevant.
So how do I redirect from one site to another making sure I only use one site?
For all your linking I would recommend using the same all over, even in scripts and code. In this case I would use http://www.example.com/. I would also recommend everyone you know that is linking to you, give them an email telling them to update that link of theirs to the correct one.
In Googles world there is something called page rank, and all individual pages of a website domain has a different pagerank. example.com and www.example.com would then have different pageranks. So you would want EVERYONE to point to the correct url.And if they are not linking to the correct one. You would want to FORCE your site to correct this. And for this you need to set up a permanent 301 redirect.
Apache Webserver:
Mod rewrite: Using it on an Apache Webserver
If you are running Apache as a webserver you must use something called mod rewrite. This little plugin for the server can not just setup redirects but can output URL's in a very nice way. To do this tutorial you must have access to the .htaccess file located in the root of your websites directory. (If it is there you need to create a blank file, and name it .htaccess ).
Then you need to edit and add the the following mod-rewrite script to your .htaccess file. (In this perticular example we will rewrite from http:// only into http://www.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www..*
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^([^.]*).(com|com/)
RewriteRule ^.*$ www.%1.%2%{REQUEST_URI} [R=301,L]
The above script will redirect:
http://yourdomain.com to http://www.yourdomain.com
Redirecting “www” URL (http://www.) to “Non-www” URL (http://)
This is the simple mod rewrite script I use to redirect “http://www.The SEO Blogger.com” to “http://The SEO Blogger.com“:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.TheSEOBlogger.com [nc]
RewriteRule (.*) TheSEOBlogger.com/$1 [R=301,L]
*Note: you should change “The SEO Blogger.com” to YOUR WEBSITE NAME! Also, if you have sub-domains, the above script will also work. Also, by ‘default’, I think WordPress gives your site URL as “http://www.yoursite.com.” If you want your site to be in “http://” URL form, you, of course, have to go to “OPTION ->General” and update your site URL to “http://yoursite.com” instead of “http://www.yoursite.com.”
Anyway, here is a live demo of those two scripts at work:
http://mint-tree.com >>> www.mint-tree.com
http://www.TheSEOBlogger.com >>> TheSEOBlogger.com
By using either one of these mod-rewrite scripts, you can have a consistent URL in your linking campaign. Now, you don’t have to worry what URL form others have used to link to your website. Now “http://” and “http://www.” are ‘consistently’ the same, although I think “http://” is a better URL form for your SEO linking campaign, just because that form is SHORTER than “http://www.”
.