Redirect your non-www urls to www

January 22nd, 2008

What is the “www and non-www issue”?

This seems like a silly issue, but it is true and can actually cause problems with the search engines.

To illustrate, previously, this site could be seen by typing in www.TheJungleMap.com  or TheJungleMap.com.  See the difference?

Who cares?

Well, if you did a search in Google, you would notice that they had about 5 pages from www.TheJungleMap.com and about 100 pages from TheJungleMap.com.  Strange, right?  Now, there is a setting in the Google Webmaster Tools that allows you to let Google know which you prefer.  That helps.

But more importantly, if users can see your site either way, they may link to either one.  This dilutes your links. 

But how does all this affect me?

Here’s where the danger lies.  If you have links to both the www version of your site and the non-www version, Google may count those as separate pages.  WHAT?!?  Google actually doesn’t realize that the www and non-www pages are the same page and consolidate the link equity (PageRank)?

Yes, it’s true.  Seems stupid to me too, but it is true (at least for now).

Do I have a “www and non-www issue”?

Check by typing this into Google (or the other search engines):

site:www.MySite.com

and

site:MySite.com

(Obviously, you need to change the “MySite.com” to be your domain name.)

See how many of your pages are listed in the index.  Is it a different number?  Then you probably should fix it.

How do I fix this (normally)?

The best way is typically to edit your .htaccess file.  I followed these instructions…

Step 1: Create .htaccess file

If it doesn’t already exist, create a file on your server’s document root (the top most web accessible directory) and name it .htaccess.

Note to windows users: Windows makes it difficult to save files begging with a period, to bypass this issue name the .htaccess file something else while editing locally, and rename on the server.

Step 2: Add rewrite code to .htaccess file

Add the following lines to the the .htaccess file:


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.yoursite.com [NC]
RewriteRule ^(.*) http://www.yoursite.com/$1 [L,R=301]

Replace www\.yoursite\.com with your own website, remembering to escape any periods with a backslash. Then, also replace http://www.yoursite.com/ with your own site’s address. That’s it.

Popularity: 48% [?]

One Response to “Redirect your non-www urls to www”

  1. Corey Creed Says:

    More information on this at http://www.stepforth.com/faq/non-www-redirect.htm

Leave a Reply

Get your Free Marketing Blueprint and sign up for local training!

Want to learn about Internet Marketing?

Hippo Internet Marketing Training now offers training classes in the Lake Norman and Charlotte, North Carolina regions.
Topics include search engine optimization, pay per click marketing, blogging, website analytics, and other Internet marketing topics.

Click here to learn more about our Charlotte area Internet marketing classes.