www vs. non-www Web Addresses

November 14, 2008

in SEO Tips

Did you know that the search engines consider www.yourwebsite.com and yourwebsite.com to be two different websites? This usually doesn’t create any major problems, but when trying to improve your site’s SEO, it can make a difference. One way to tell if this issue is affecting your website is to go to a backlink checker site like http://popuri.us/ and entering your website both with and without the “www.” in front. If the number of backlinks found differs, this could be a problem.

The good news is that there is a relatively easy way to solve this problem. It doesn’t matter if you prefer having the www in your web address or not, it is just important to be consistent. The easiest way to ensure this is the case is to use a 301 redirect to force one of the options. This can be implemented via your website’s .htaccess file. The way this is accomplished depends on the type of server your host uses. If you do not know which type is correct, please check with your host.

Apache Servers

  1. Make sure that your hosting provider has the Apache Rewrite Module turned on. Many hosts have this on by default, but you can always request that the module be enabled for your account. It is rare that a hosting provider would have a problem with this.
  2. Find the .htaccess file in your website’s root web folder and open the file in an editor. Any text editor should work fine for this including notepad.
  3. Make a backup copy of this file just in case something goes wrong.
  4. Add the following code to the .htaccess file. Make sure that you replace the “yourwebsite.com” with your website information.RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourwebsite.com
    RewriteRule (.*) http://www.yourwebsite.com/$1 [R=301,L]
  5. Save the .htaccess file and upload it back to your server.
  6. You can test the fix by visiting a couple of different pages on your site without entering the “www.” in the web address. You should see the address automatically correct to include “www.” in your browser’s address bar.

Microsoft IIS Servers

  1. Using Internet Services Manager, create a new IP-based website using the http://www.yourwebsite.com URL. You can avoid using a unique IP by using the host header (virtual website) of www.yourwebsite.com.
  2. Add your domain-revised version of the following ASP code to the default home page for your website:< %@ Language=VBScript %>
    < %
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, http://www.yourwebsite.com
    %>
    ***Do not change the spacing or line placement in the code above!
  3. Test your website in the same manner as described in #6 above.

It will take a little while for all of the links to be redirected to the correct version of your address, but after a few weeks you should notice the number of backlinks even out.

Google Buzz

{ 1 comment… read it below or add one }

1 freezonal December 20, 2009 at 11:10 am

Thank you for this information. But if you have a canonical url plugin installed in your blog, this problem can be minimized without editing the .htaccess ;-)

Reply

Leave a Comment

CommentLuv Enabled

Previous post:

Next post: