title: Add HTTPS to already existing Mod Rewrite
body: <p>I have the following rules and conditions in my <code>mod_rewrite</code> and like to add HTTPS to it. I like to confirm the following it accurate before publishing it live.</p>
  
  <p><strong>Current Rules and Conditions</strong></p>
  
  <pre><code>    RewriteEngine On
      RewriteCond %{REQUEST_URI} \.jpg$ [NC]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .* /home/domain.com/public_html/missing.png [L]
      RewriteCond %{HTTP_HOST} ^www.olddomain.com$
      RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteCond %{HTTP_HOST} !^$
      RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      RewriteRule ^index.html$ http://www.domain.com/ [L,R=301]
  </code></pre>
  
  <p><strong>New Rules and Conditions</strong></p>
  
  <pre><code>    RewriteEngine On
      RewriteCond %{REQUEST_URI} \.jpg$ [NC]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .* /home/domain.com/public_html/missing.png [L]
      RewriteCond %{HTTP_HOST} ^www.olddomain.com$
      RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
      RewriteCond %{HTTPS} Off
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteCond %{HTTP_HOST} !^$
      RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      RewriteRule ^index.html$ https://www.domain.com/ [L,R=301]
  </code></pre>