title: .htaccess redirect to example.com except for directory redirect to example.com/example
body: <p>Variations on this question have been asked, and so I apologize in advance -- I simply cannot get this to work. I know the devil is in the details with the .htaccess, so I'm sure I'm missing something small.</p>
  
  <p>Here's what have:</p>
  
  <p>I have a page: example.com/ which redirects all traffic to its https equivalent. I'm building the next version of the same site inside of the directory example.com/example.com/ I'm trying to write a redirect that will send all traffic to its https equivalent except for the directory that I'm working in, which should be left alone. My problem is, whenever I try to access example.com/example.com/ I get redirected to the 404 of example.com (which makes sense). I just can't get the redirect to not loop indefinitely.</p>
  
  <p>I currently have a redirect from http to https for example.com as follows:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{SERVER_PORT} 80
  RewriteRule ^(.*)$ https://example.com/$1 [R,L]
  </code></pre>
  
  <p>This works just fine, and only causes troubles when I try to access the subfolder.</p>
  
  <p><strong>tl;dr
  Here's what I need:</strong></p>
  
  <pre><code>http://example.com/ REDIRECTS TO https://example.com/
  
  http://example.com/[anything else] REDIRECTS TO https://example.com/[anything else]
  
  https://example.com/example.com/ SHOULD NOT REDIRECT
  </code></pre>