title: .htaccess - SSL redicect condition for one specific domain not working
body: <p>I have an apache server with multiple websites hosted:</p>
  
  <pre><code>main-website.com 
  subdomain1.main-website.com    
  subdomain2.main-website.com 
  another-website1.com 
  another-website2.com    
  another-website3.com
  </code></pre>
  
  <p>I need to redirect only <a href="https://www.main-website.com" rel="nofollow noreferrer">https://www.main-website.com</a> to <a href="https://www.main-website.com" rel="nofollow noreferrer">https://www.main-website.com</a></p>
  
  <p>The subdomains and all the other websites don't need a ssl certificate; therefore I want to exclude them from redirection by specifying that only main-website needs to be redirected.</p>
  
  <p>This is my .htaccess syntax (it seems correct having researched a lot on this topoic)</p>
  
  <pre><code>#NON-WWW to WWW (whis applies to all domains and subdomains)
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  #redirect HTTP to HTTPS only for main-website.com:
  RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} main-website.com [NC]
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  
  <p>The condition of redirecting main-website.com has been specified, but it does not work! In fact every other domain and subdomain is redirected to HTTPS!!</p>
  
  <p>Do you know where the error could be?</p>
  
  <p>Thank you :)</p>