title: RewriteRule http_host is ignored?
body: <p>A web account has different domains connected but only domain1.com is reachable with https. So I'd like to send all domains to <a href="https://www.domain1.com" rel="nofollow noreferrer">https://www.domain1.com</a>.</p>
  
  <p>My idea was to have a rule which checks for port 443 first.
  If not used it leads to <a href="https://www.domain1.com" rel="nofollow noreferrer">https://www.domain1.com</a>.
  But if https is already used and domain name is different, then rewrite to <a href="https://www.domain1.com" rel="nofollow noreferrer">https://www.domain1.com</a>, too.</p>
  
  <pre><code>RewriteEngine On
  
  RewriteCond %{SERVER_PORT} !^443$
  RewriteRule .* https://www.domain1.com [L]
  
  RewriteCond %{HTTP_HOST} !^www\.domain1\.com$ [NC]
  RewriteRule .* https://www.domain1.com [R=301,L]
  </code></pre>
  
  <p>First Rule (443) works, but the other does not. If one of the additional domains is called with https://, then browser shows message about unsafe domain, as SSL certificate is for wrong domain.</p>
  
  <p>What's wrong?</p>