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

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]

See Also
YouTube features for Content Creators

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.

View Comments (19)
  • 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.

  • 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.

  • 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.

  • 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

  • @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.

  • 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?

Scroll To Top