Last updated on November 17th, 2015 at 05:58 am

In this tutorial you will see how to add WWW to domain using htaccess.
.htaccess files allow you to control access to parts of your website. There are many ways in which to use .htaccess, including password protection of directories, URL rewriting with mod_rewrite, custom error 404 pages, redirection, and banning undesirable spiders.
.htaccess files can only be used on our Linux hosting accounts. .htaccess files can do more harm than good if used incorrectly and should only be used by experienced users.

For www
——-

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

For Subdomains
————–

RewriteCond %{HTTP_HOST} ^yoursite\.com$ [NC]
RewriteRule ^(.*)$ SUBDOMAINNAME.yoursite.com/$1 [L,R=301]

Leave a Reply

Your email address will not be published. Required fields are marked *