You will find lots of code good examples for implementing .htaccess to include www to some url but they're usually limited to presenting http. does anybody have a good example of ways to get results in the two cases?


RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The 2nd condition inspections when the HTTPS atmosphere variable (either on or off) is placed to on and captures the appended s that's then provided with %1. Whether it doesn’t match, %1 is simply a clear string.