Jan
12

SEO Tips: Enforcing WWW

Written by Jonathan Dingman
01/12/2007 7:53 ET - Filed under Search

Something that I’ve been using for almost a year now is something very simple yet very effective. Enforcing the sub-domain of www. While some of you may consider this to be a basic principal while running your site, others may have not known about it.

Enforcing WWW

First, before being able to use this code, you need to make sure your webserver (normally Apache) has mod_rewrite compiled into it. Next, after verifying that, put the following code into a file called .htaccess in the root of your site (normally something like /home/username/public_html/.htaccess)

RewriteEngine On
Options +FollowSymLinks
RewriteBase /

RewriteCond %{HTTP_HOST} !^mydomain\.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,QSA,L]

What will this code do for me?

When other sites link to your site, they may or may not include the www in your domain name. This causes a problem for search engines because they now see http://mydomain.com and http://www.mydomain.com To a search engine, sub-domains are completely different domains than the primary domain. When looking at a site, such as Google.com, you will see that when you visit http://google.com is actually forwards you to http://www.google.com

So in short, you are forcing everyone to look at just one domain name instead of two.

Why does a search engine consider a sub-domain different than the primary domain?
This part is simple. WWW is considered a sub-domain because that’s exactly what it is. The world has come to know the Internet as the World Wide Web and always thought to add the www in front of a domain name, but in reality, it’s just a sub-domain of the primary domain.

How will setting this help my search rankings?

Adding this bit of code to your site will let search engines know which domain you are actually using and which one they need to be giving “strength” to for search results.

Personal note: I do this for all of my sites to ensure that I can get the highest possible rankings.

Tags:
  • Subscribe via RSS
  • Bookmark to del.icio.us