Forcing www. in the URL helps dig you out of Google’s Supplemental Index

It’s never a good idea to have duplicates of the same page indexed by Google. Why’s that? Because they will be placed into the Supplemental Index.

What does this mean? As described by Wikipedia, “Supplemental Result is a supplementry Google search Index of less important web pages according to the Google’s PageRank”.

One of the easiest ways to ensure that you have as little duplicate pages as possible in Google’s web database is to use the same base host name for your website.

This means that you either have URLs that look like this: http://example.com/ or this: http://www.example.com/ Both URLs would go to the same page, but to a robot, they are different sites entirely and so one would appear as a duplicate of the other.

In order to ensure that you only use one, all you need to do is modify your site’s .htaccess file (this is simply a file named .htaccess that you place in your site’s /public_html/ folder.) I personally prefer forcing www. in the URL rather than removing it because that string is commonly associated with a website, so in my opinion, the URL is more permanently imprinted into the visitor’s mind.

In the .htaccess file, you need to enter the following:

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

This will force any visits to your site that does not use www. to use it. If someone visits http://example.com/index.php?do=blog , it will redirect to http://www.example.com/index.php?do=blog

And that’s it! It’s also backwards compatible, so any links that point to your site that do not use www. will simply redirect to the www. version of your site’s URL.

Gary King is a professional freelance web developer, primarily using Ruby on Rails and PHP to create cool new websites. When he’s not trying to take over the world one blog at a time, you can find him mulling over his thoughts at King Gary.

Tags:

This post was written by

You can visit the for a short bio, more posts, and other information about the author.

Submissions & Subscriptions

Submit the post to Reddit, StumbleUpon, Digg or Del.icio.us.

Did you like it? Then subscribe to our RSS feed!



  1. Forcing www. in the URL helps dig you out of Google’s Supplemental ... | Talk UtopiaJune 7, 2007 at 6:30 am
  2. By J. Angelo Racoma posted on June 7, 2007 at 7:24 am
    Want an avatar? Get a gravatar! • You can link to this comment

    One curious thing is that your www and non-www site will have different pageranks, too! :)

    Reply

  3. By Going Like Sixty posted on June 7, 2007 at 11:09 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Thanks, I always was curious about that!
    Mystery solved.

    Reply

  4. By Andy C posted on June 7, 2007 at 11:09 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Nice tip. On bluehost, I had to add ‘RewriteEngine On’ and then it worked fine.

    Reply

  5. By franky posted on June 7, 2007 at 11:13 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Angelo, both rankings should merge after the 301-redirect (increasing the strength of the highest PR) and you can also use the Google Webmaster Console to set www/nowww as preferred site.

    Reply

  6. By Patrix posted on June 7, 2007 at 12:41 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Strangely although I was using this fix in my .htaccess, it works only for the main page i.e. domain.com but if I try out domain.com/post-name, it still goes to domain.com instead of http://www.domain.com/post-name.

    Interestingly, the www-redirect plugin seems to work better.

    Reply

  7. By Gary King posted on June 7, 2007 at 3:32 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Patrix, the www-redirect plugin is a good plugin, but it only works for WordPress-powered pages.

    Reply

  8. Independent Writing & Speaking Consultant — J.T Dabbagian’s BlogJune 10, 2007 at 10:27 am
  9. Blog Monetizing & Other Changes « J.T’s Productivity BlogJune 10, 2007 at 10:27 am
  10. By Karlo.PinoyBlogero posted on June 11, 2007 at 2:23 am
    Want an avatar? Get a gravatar! • You can link to this comment

    hi. I have tried this method before. It did redirect my blog, however, errors started to occur on my wordpress blog. i can’t post articles, i can’t add categories, and such.

    I tried this on both WordPress 2.1 and 2.2, with different themes, and deactivated plugins, all were showing the same errors.

    The problem was soon solved as soon as I removed the redirect code on my .htaccess file. I checked out the forums and there are a lot of people that are having the same problems when they have installed this code on their site.

    Just sharing my experience.

    Reply

  11. By Elixir Web Solutions posted on June 15, 2007 at 1:36 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Hi gary,
    I am SEO … so i know about cronical URL issues.
    We use this technic in our sites ..and its really helpful to get out from suppliment results.
    One more thing u can do . we can do 301 redirect on /index.htm to http://www.url.com becoz to prevent from duplication of url.
    neways ..Thanks for updating us..

    Thanks& regards,
    Elixir Web Solutions
    Web Design Services from India

    Reply

  12. By J.T Dabbagian posted on June 15, 2007 at 11:54 am
    Want an avatar? Get a gravatar! • You can link to this comment

    @Karlo.PinoyBlogero

    Yeah, this happened to me too. I found out on another site that all you have to do is go to WP’s settings, and where it says the URLs for the WordPress address and blog address, put down http://www.blog.com, instead of blog.com. It’ll fix the problem.

    Reply

  13. By J.T Dabbagian posted on June 15, 2007 at 11:55 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Crap, Wrong URL for my site…Sorry to double-post, but don’t want people going to the dead blog…

    http://www.jtdabbagian.com

    Reply

  14. By Jezebelus posted on June 19, 2007 at 10:00 am
    Want an avatar? Get a gravatar! • You can link to this comment

    This seem to be true because I found it on 100 places. Well guess I’m gonna change it also for myself. Thanks.

    Reply

  15. By Maureen Francis posted on June 23, 2007 at 8:05 am
    Want an avatar? Get a gravatar! • You can link to this comment

    my site without www. is a PR 5 and with is a PR 4. I would rather be directing to without www. but I am blogging from within a /blog/ directory. How would I modify that code?

    Reply

  16. 在网址里加入www. 让你在谷歌的补充索引里更容易被找到 : 先驱博客 - The Blog Herald ChinaJune 26, 2007 at 9:11 am
  17. By Marcus posted on July 3, 2007 at 7:23 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Very useful text. I’ve just modified my .htaccess file, I hope it will help.

    Reply

  18. Free blowjob.June 30, 2008 at 12:36 pm
  19. By konstelin posted on September 6, 2009 at 8:21 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Marcus, I’m new in PHP why I need to modify .htaccess file??

    Reply

  20. By Live Stream posted on December 14, 2011 at 2:34 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Nice and concise article, many things i never knew. . . We never know how much talent is devastated this way.

    Reply

  21. By Live Stream posted on December 14, 2011 at 5:56 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Nice post. I be taught one thing more challenging on completely different blogs everyday. It should all the time be stimulating to read content material from other writers and apply somewhat something from their store. I’d want to make use of some with the content material on my blog whether or not you don’t mind. Natually I’ll give you a hyperlink on your net blog. Thanks for sharing.

    Reply

  22. By Moowervavoupe posted on December 14, 2011 at 8:52 am
    Want an avatar? Get a gravatar! • You can link to this comment

    путешествия по подмосковью отзывы путешествия
    италия путешествия водные путешествия путешествия по израилю путешествия по кубе

    Reply

  23. By Live Stream posted on December 14, 2011 at 4:44 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    For some reasons, I can relate to the content material of your post. In any case, I can say that you just do a very good job in updating your website. Additionally, I am continually searching for similar backlinks. I’d be more than pleased to start a hyperlink sharing with you. I don’t require you to spend time to put my link on the home page – simply approve this comment will do. Let me know more about your hyperlink, cheers!

    Reply

  24. By Chelsea Live Stream posted on December 18, 2011 at 11:52 am
    Want an avatar? Get a gravatar! • You can link to this comment

    This blog kept my own faith up when I was wondering if I must quit. I’m lastly starting to get a bit of understanding of this theme and how to benefit. Additionally it is hard working on your part because author of this fantastic post. I’ve simply started a weblog, and I think this article is good advice to the person who wants to learn the essential strategies. The only problem is I need more time to understand and learn more. It’s possible that will improve while i start my annual vacation next month.

    Reply

  25. By Real Madrid vs Barcelona Live posted on December 18, 2011 at 10:50 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    It’s as if you read my thoughts! You gaze to understand a lot concerning this, including anyone published your manual in it or something like that. I feel you could do with a few r.h. to energy the content property somewhat, however besides that, this can be excellent blog site. A fantastic go through. We?lmost all absolutely return.

    Reply

  26. By Tottenham Hotspur Free posted on December 19, 2011 at 12:16 am
    Want an avatar? Get a gravatar! • You can link to this comment

    While searching Yahoo I found this page in the results and I didn’t think it fit…

    Reply

    Your words are your own, so be nice and helpful if you can. If this is the first time you're posting a comment, it might go into moderation. Don't worry, it's not lost, so there's no need to repost it! We accept clean XHTML in comments, but don't overdo it please.