Force website to use www.

3d Animation

To force a HTML website to always use the www. – add the following bit of code to the .htaccess file in the root directory. Replace example-site to your actual domain name. This should automatically redirect the non www. to the www. domain.

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