title: Rewrite rule is applying to existing directories
body: <p>In my apache site configuration file, I have the following. The rewrite rule works fine, but the rule is applying to existing directories which my rewrite conditions were supposed to fix. Here is my rewrite script:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^([a-zA-Z0-9_]+)/?$ test.php?n=$1 [L]
  </code></pre>
  
  <p>So <code>example.com/username</code> works great and uses <code>test.php</code>, but also when I enter an existing sub-directory that has an <code>index.php</code> file in it, aka, <code>example.com/myDirectory/</code> still uses test.php. Any idea what's wrong with my script? Thanks.</p>
  
  <p>Below is a rewrite log for request <code>myDirectory</code> which is an existing directory:</p>
  
  <pre><code>(2) init rewrite engine with requested uri /myDirectory/
  (1) pass through /myDirectory/
  (3) [perdir /var/www/] strip per-dir prefix: /var/www/myDirectory/ -&gt; myDirectory/
  (3) [perdir /var/www/] applying pattern '^tag/([a-zA-Z0-9-]+)/?$' to uri 'myDirectory/'
  (3) [perdir /var/www/] strip per-dir prefix: /var/www/myDirectory/ -&gt; myDirectory/
  (3) [perdir /var/www/] applying pattern '^([a-zA-Z0-9_]+)/?$' to uri 'myDirectory/'
  (2) [perdir /var/www/] rewrite 'myDirectory/' -&gt; 'test.php?n=myDirectory'
  (3) split uri=test.php?n=myDirectory -&gt; uri=test.php, args=n=myDirectory
  </code></pre>
  
  <p>And here is the log for request <code>bananas</code> which is meant to use the rewrite (and does):</p>
  
  <pre><code>(2) init rewrite engine with requested uri /bananas
  (1) pass through /bananas
  (3) [perdir /var/www/] strip per-dir prefix: /var/www/bananas -&gt; bananas
  (3) [perdir /var/www/] applying pattern '^tag/([a-zA-Z0-9-]+)/?$' to uri 'bananas'
  (3) [perdir /var/www/] strip per-dir prefix: /var/www/bananas -&gt; bananas
  (3) [perdir /var/www/] applying pattern '^([a-zA-Z0-9_]+)/?$' to uri 'bananas'
  (2) [perdir /var/www/] rewrite 'bananas' -&gt; 'test.php?n=bananas'
  (3) split uri=test.php?n=bananas -&gt; uri=test.php, args=n=bananas
  </code></pre>