title: Redirect all traffic to HTTPS except for one directory should force HTTP
body: <p>I tried rewrite conditions from many posts, but none seem to work.</p>
  
  <p>I want to force <code>HTTPS</code> on the entire site. Except for one directory has to be forced to <code>HTTP</code>.</p>
  
  <p>Everything with <code>www.example.com</code> should be <code>HTTPS</code>.</p>
  
  <p>Anything in <code>dir3</code>: <code>www.example.com/dir1/dir2/dir3/test.php</code> should be forced <code>HTTP</code>.</p>
  
  <p>Here is what I have so far.</p>
  
  <pre><code>RewriteEngine On
  
  # Redirect HTTP traffic to HTTPS
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
  
  RewriteCond %{HTTPS} on
  RewriteRule ^dir3/ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </code></pre>