title: mod_rewrite END flag not working in httpd 2.4
body: <p>The <code>END</code> flag for mod_rewrite in Apache 2.4 does not appear to be working correctly. I have a directory named <code>test</code> with a file <code>test.html</code>. I have placed an <code>.htaccess</code> file in the directory with the following content</p>
  
  <pre><code>RewriteEngine on
  
  RewriteRule ^test$ test.html [NC,QSA,END]
  RewriteRule ^$ test.html  [NC,QSA,END]
  </code></pre>
  
  <p>Here is the rewrite log for the request <a href="http://localhost.dev/test/" rel="nofollow">http://localhost.dev/test/</a></p>
  
  <pre><code>[...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/ -&gt; 
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] applying pattern '^test$' to uri ''
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/ -&gt; 
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] applying pattern '^$' to uri ''
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] rewrite '' -&gt; 'test.html'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] add per-dir prefix: test.html -&gt; /var/www/vhosts/test/test.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] strip document_root prefix: /var/www/vhosts/test/test.html -&gt; /test/test.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a56d60/initial] [perdir /var/www/vhosts/test/] internal redirect with /test/test.html [INTERNAL REDIRECT]
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/index.php -&gt; index.php
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] applying pattern '^test$' to uri 'index.php'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/index.php -&gt; index.php
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] applying pattern '^$' to uri 'index.php'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] pass through /var/www/vhosts/test/index.php
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/index.html -&gt; index.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] applying pattern '^test$' to uri 'index.html'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/index.html -&gt; index.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] applying pattern '^$' to uri 'index.html'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a44060/subreq] [perdir /var/www/vhosts/test/] pass through /var/www/vhosts/test/index.html
  </code></pre>
  
  <p>Why is mod_rewrite making sub requests for directory index files <code>index.html</code> and <code>index.php</code>, when the second rule matches the request?</p>
  
  <p>Request for <a href="http://localhost.dev/test/test" rel="nofollow">http://localhost.dev/test/test</a> works without any sub request, as expected</p>
  
  <pre><code>[...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] strip per-dir prefix: /var/www/vhosts/test/test -&gt; test
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] applying pattern '^test$' to uri 'test'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] rewrite 'test' -&gt; 'test.html'
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] add per-dir prefix: test.html -&gt; /var/www/vhosts/test/test.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] strip document_root prefix: /var/www/vhosts/test/test.html -&gt; /test/test.html
  [...] 10.0.2.2 - - [localhost.dev/sid#2532c00][rid#2a58b20/initial] [perdir /var/www/vhosts/test/] internal redirect with /test/test.html [INTERNAL REDIRECT]
  </code></pre>
  
  <p>I have tried using <code>L</code> and <code>END</code> flags, independently and together.</p>