Force WWW on your Domain / URL

Because i’ve been getting queries from search engine from someone who want his domain name always use the www version instead of non www version, i decided to post it again. Well although i’ve already write about this before, but it seems for some people they don’t know which part is the force www.

And because i’ve already explained it before, i’m not going into much detail and don’t forget to put this in your .htaccess file :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.your-domain-name\.com  [NC]
RewriteRule ^(.*)$$1 [R=301,L]

That’s it, and you’re finished, and as a side note you should choose to use only the www or non www version of your domain name, because Google doesn’t like duplicate content on same website / domain name. ;)


Note: Comment may not appear right away.

One comment on “Force WWW on your Domain / URL