I have a wordpress multisite in network mode via wp multi network plugin.
I’ve been trying to use .htaccess
rules to force all urls to be https://www.
eg:
https://domain.com
tohttps://www.domain.com
http://domain.com
tohttps://www.domain.com
http://www.domain.com
tohttps://www.domain.com
I’ve found these variations online but I’m not sure what would be the cleanest way to do this?
## force HTTPS and www
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^(dev|www)\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI}/ [R=302,L]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}/ [R=302,L]
RewriteCond %{HTTP_HOST} !^(dev|www)\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI}/ [R=302,L]
What’s the best way to accomplish this?
Thank you