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.

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! :)
Want an avatar? Get a gravatar! • You can link to this comment
Thanks, I always was curious about that!
Mystery solved.
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.
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.
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.
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.
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.
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
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.
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
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.
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?
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.
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??
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.
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.
Want an avatar? Get a gravatar! • You can link to this comment
путешествия по подмосковью отзывы путешествия
италия путешествия водные путешествия путешествия по израилю путешествия по кубе
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!
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.
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.
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…