title: .htaccess mod-rewrite conflicting with subfolder auth
body: <p>I have a site which redirects all requests for files/folders which don't exist to an index file using .htaccess: </p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d 
  RewriteRule ^.*$ - [NC,L]
  RewriteRule !admin/* index.php [NC,L]
  </code></pre>
  
  <p>There is a folder "admin/" which has the following in .htaccess for auth: </p>
  
  <pre><code>AuthType Basic
  AuthName "admin"
  AuthUserFile "/path/to/passwd"
  require valid-user
  </code></pre>
  
  <p>Adding the auth .htaccess file in "admin/" causes the request to be trapped by mod-rewrite instead of providing the authentication response. I've tried a few different things trying to work around this (including this: <a href="https://stackoverflow.com/questions/1641666/htaccess-rewrite-and-auth-conflict">htaccess rewrite and auth conflict</a>), but couldn't get any purchase. </p>
  
  <p>Thanks. </p>
  
  <p><strong>EDIT:</strong> If I'm already authenticated, the rewrite rule <em>works</em> allowing me to access the "admin/" folder. So it seems that it's the authentication challenge that's doing something wonky.</p>