This works on any domain

#Remove the below two comments to disable it on localhost
#RewriteCond %{HTTP_HOST} !=localhost
#RewriteCond %{HTTP_HOST} !=127.0.0.1
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Pin It on Pinterest

Share This