
Many customers at some point request to force either the www or non-www version of their site to display in their visitor's browser. For example, you can have www.example.com or simply example.com display in an address bar.
There is a common thought that forcing one format is better for search engine optimization.
To force non-www to www version of your web site:
step 1: Edit your .htaccess file using your favourite ftp client.
step 2: Put the following content
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]