I'm trying to get the server to point correctly no matter what combination of URL is entered, for example, all of the following should redirect to
https://www....
mydomain.com
www.mydomain.comhttps://mydomain.comhttp://www.mydomain.commydomain.com/anything/blah
.php
www.mydomain.com/something/check/--- and so on ---
any of these should add www if not present and https if not present. The closest I can get is using this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$
https://www.%{HTTP_HOST}/$
1 [R=301,L]
RewriteCond %{HTTPS} off
#RewriteRule (.*)
https://%{HTTP_HOST}%{REQU
EST_URI} [L]
RewriteRule (.*)
https://www.mydomain.com%{
REQUEST_UR
I} [L]
Note in the 2nd rule i'm explicitly declaring "mydomain.com" to make sure the www is in there. this is because if I visit
https://mydomain.com, it won't add the
www. it seems to work if i go to mydomain.com and
www.mydomain.com, but
https://mydomain.com causes the "this certificate is invalid" message. How do I accomplish this?
Start Free Trial