title: RewriteCond not working on force https for HTTP_HOST
body: <p>I am trying to write a condition that will force https on the live host name(domain.com), but not if it's on our local testing host name (domain.local).</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>#force https
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !domain\.local [NC]
  RewriteRule ^(.*?)$ https://www.domain.com/$1 [L,R=301]
  </code></pre>
  
  <p>This condition rewrites to https but also redirects domain.local to domain.com</p>
  
  <p>I've also tried this condition in place of the middle condition which doesn't do anything on .local or .com:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^domain\.com [NC]
  </code></pre>
  
  <p>Here is the complete contents of my htaccess file</p>
  
  <pre><code>Options +FollowSymLinks
  RewriteEngine On
  RewriteBase /
  
  #force ssl
  RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} ^domain\.com
  RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L,NE]
  
  #rewrite payments subdomain
  RewriteCond %{HTTP_HOST} ^payments\.domain\.local$ [NC]
  RewriteRule ^(.*)$ https://otherdomain.com/dmi_domain.htm [NC,R=301,L]
  RewriteCond %{HTTP_HOST} ^payments\.domain\.com$ [NC]
  RewriteRule ^(.*)$ https://otherdomain.com/loanadmin/dmi_domain.htm [NC,R=301,L]
  
  #agents folder to subdomain
  RewriteCond %{HTTP_HOST} ^agents\.domain\.local$ [NC]
  RewriteRule ^agents/(.*)$ /agents/$1 [L,P]
  RewriteCond %{HTTP_HOST} ^agents\.domain\.com$ [NC]
  RewriteRule ^agents/(.*)$ /agents/$1 [L,P]
  
  #force www for .com
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^payments\. [NC]
  RewriteCond %{HTTP_HOST} !^agents\. [NC]
  RewriteCond %{HTTP_HOST} !^domain\.local
  RewriteCond %{REQUEST_URI} !^/blog/
  RewriteCond %{REQUEST_URI} !^/questions/
  RewriteRule ^(.*?)$ https://www.%{HTTP_HOST}/$1 [L,R=301]
  
  #force www for .local
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^payments\. [NC]
  RewriteCond %{HTTP_HOST} !^agents\. [NC]
  RewriteCond %{HTTP_HOST} !^domain\.com
  RewriteCond %{REQUEST_URI} !^/blog/
  RewriteCond %{REQUEST_URI} !^/questions/
  RewriteRule ^(.*?)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
  
  #force trailing slash
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !(.*)/$
  RewriteCond %{REQUEST_URI} !^/rate-panel/xml/
  RewriteCond %{REQUEST_URI} !^/blog/
  RewriteCond %{REQUEST_URI} !^/questions/
  RewriteRule ^(.*)$ $1/ [L,R=301]
  
  #get rid of index.php in url
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/blog/
  RewriteCond %{REQUEST_URI} !^/questions/
  RewriteRule ^(.*)$ /index.php/$1 [L]
  </code></pre>
  
  <p>thanks</p>