Add www to domain using htaccess
Add www to domain using htaccess
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]Add www to domain using htaccess,