How to Force the WWW Version of a Domain Name
For “www” With .htaccess
Require the “www” in a domain (you want to do this so that Google or other search engines don’t think there are 2 versions of your site out there – the www version (like “www.yourdomain.com”) and the non-www version. This is done for SEO reasons:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www..*
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^([^.]*).(com|com/)
RewriteRule ^.*$ https://www.%1.%2%{REQUEST_URI} [R=301,L]📄 Download a PDF of This Article
