title: RewriteCond check if directory exists with an index file
body: <p>I am trying to do a rewrite for all requests EXCEPT if the URL points to:</p>
  
  <ul>
  <li>An existing file</li>
  <li>A directory with an index file</li>
  </ul>
  
  <p>So I have the following that should have dealt with it:</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} !-s
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule ^(.*)$ redirect.php [QSA]
  </code></pre>
  
  <p>But when I navigate to a folder that contains an <code>index.php</code> (and yes I have checked that <code>DirectoryIndex</code> is set to <code>index.php</code>), it still performs the rewrite.</p>
  
  <p>The funny thing I also found is that if I had a <code>.htaccess</code> in that folder with <code>RewriteEngine on</code> (just that), then the rewrite rule above works...</p>
  
  <p>Any pointers?</p>