Add to Favorites

Redirect your Site to www

This week I've learned a nifty little trick having to do with .htaccess and site redirection. I'm sure you know that you can reach a web site with the normal www. or you can leave it off. The end result is no different to you. sBut it is to Google. The search engines considers each address version a different site, and there's a lot of duplicate content there.

.htaccess can force your site to always redirect to www. Toss this little bit of code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

into your .htaccess file. This will redirect anyone using the non-www address to the www version, and Google will only index one version of your site.


Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up