How to use www in url

A search engine like Google,yahoo,bing would see anvar.in and www.anvar.in as essentially two separate websites. They recommend you pick one version and you can setup it with the help of htaccess

Code in the anvar.in domain’s .htaccess file:

RewriteEngine on
 RewriteCond %{HTTP_HOST} ^xyz.com [NC]
 RewriteRule ^(.*)$ http://www.xyz.com/$1 [L,R=301,NC]