I have a problem with a site that I'm working on. There are a few sites located in the same environment. The server uses one SSL certificate that protects these domains like such: domain1.com, www.domain1.com and www.domain2.com.
The SSL certificate does not protect domain2.com without the www subdomain.
The problem is that (specifically on mobile) domain2.com is not being protected. If we visit www.domain2.com, it is protected.
Why are the following conditions not working on mobile to redirect the site to the www version before the warning is thrown that the site is not secure?
# Redirect Non-WWW to WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.\*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
# Force SSL on entire site
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.\*)$ https://%{HTTP_HOST}/$1 [R,L]
These are the first rules in the .htaccess file before WordPress is loaded.