This is a simple guide of how to add www. to your website URL automatically using .htaccess i will show you how it works and what the diffrent components are for:

RewriteEngine on - This turns on the page rewrite engine this is should not be removed

Options FollowSymlinks # This is not compulsory and can be removed if you are running a apache webserver.

rewritecond %{http_host} ^nodesales.com [nc] # Replace nodesales with your website URL.

rewriterule ^(.*)$ http://www.nodesales.com/$1 [r=301,nc] # This will be the new website URL i would recommend keeping the http:// as it makes loading faster.

Now fill in the information and place it in your .htaccess folder in your site root.

Example:
Code: 
RewriteEngine on
Code: 
Options FollowSymlinks

rewritecond %{http_host} ^nodesales.com [nc]

rewriterule ^(.*)$ http://www.nodesales.com/$1 [r=301,nc]


Enjoy.
Lukey Reviewed by Lukey on . Automatically Add www. onto Website URL. This is a simple guide of how to add www. to your website URL automatically using .htaccess i will show you how it works and what the diffrent components are for: RewriteEngine on - This turns on the page rewrite engine this is should not be removed Options FollowSymlinks # This is not compulsory and can be removed if you are running a apache webserver. rewritecond %{http_host} ^nodesales.com # Replace nodesales with your website URL. rewriterule ^(.*)$ http://www.nodesales.com/$1 Rating: 5