SEO: Redirecting users from your www subdomain to the non-www domain

One of the major things people don’t understand about Search Engine Optimization (SEO) is that google assigns a PageRank per URL. So if you have a friend who links to and another friend that links to, google doesn’t combine them and acts as if one person is linking to each page.

However, if, when crawling your page, the googlebot is redirected via a 301 Moved Permanently, the googlebot learns that the two pages are the same. This is incredibly easy to do if mod_rewrite is enable on your Apache installation.

To do this, open up the .htaccess for your site and add these lines:

# To redirect all users to access the site WITHOUT the 'www.' prefix,
# ( will be redirected to
# adapt and uncomment the following:
RewriteCond %{HTTP_HOST} ^www\.yourpage\.com$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Remember to replace “” with your actual URL. This redirect/rewrite will preserve the query so will still get translated to

Be Sociable, Share!

No related posts.

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>