use htaccess to add www with https support
Sure:
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The second condition checks if the HTTPS environment variable (either on
or off
) is set to on
and captures the appended s
that is then available with %1
. If it doesn’t match, %1
is just an empty string.