title: Stopping mod_rewrite rule match, circular execution
body: <p>I have old.htm and new.htm on a directory, and I need to load file.php every time someone access old.htm, and load old.htm every time some access new.htm.</p>
  
  <p>Here are my non-working rules:</p>
  
  <pre><code>RewriteRule ^old\.htm$ file.php?%{REQUEST_URI} [L]
  RewriteRule ^new\.htm$ old.htm [L]
  </code></pre>
  
  <p>When old.htm is accessed, file.php is called. When new.htm is accessed, old.htm is "accessed" again, rewriting it to file.php. So, in the end, accessing new.php loads file.php, but I want to stop at old.htm.</p>
  
  <p>Any ideas?</p>
  
  <p>Here's RewriteLogLevel 3 output if it helps:</p>
  
  <p>old.htm</p>
  
  <pre><code>[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/old.htm -&gt; old.htm
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^old\.htm$' to uri 'old.htm'
  [rid#2006ee0/initial] (2) [per-dir D:/dev/www/estadao/arquivoweb/] rewrite old.htm -&gt; file.php?/arquivoweb/old.htm
  [rid#2006ee0/initial] (3) split uri=file.php?/arquivoweb/old.htm -&gt; uri=file.php, args=/arquivoweb/old.htm
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] add per-dir prefix: file.php -&gt; D:/dev/www/estadao/arquivoweb/file.php
  [rid#2006ee0/initial] (2) [per-dir D:/dev/www/estadao/arquivoweb/] strip document_root prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; /arquivoweb/file.php
  [rid#2006ee0/initial] (1) [per-dir D:/dev/www/estadao/arquivoweb/] internal redirect with /arquivoweb/file.php [INTERNAL REDIRECT]
  [rid#200fb20/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; file.php
  [rid#200fb20/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^old\.htm$' to uri 'file.php'
  [rid#200fb20/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; file.php
  [rid#200fb20/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^new\.htm$' to uri 'file.php'
  [rid#200fb20/initial/redir#1] (1) [per-dir D:/dev/www/estadao/arquivoweb/] pass through D:/dev/www/estadao/arquivoweb/file.php
  </code></pre>
  
  <p>new.htm</p>
  
  <pre><code>[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/new.htm -&gt; new.htm
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^old\.htm$' to uri 'new.htm'
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/new.htm -&gt; new.htm
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^new\.htm$' to uri 'new.htm'
  [rid#2006ee0/initial] (2) [per-dir D:/dev/www/estadao/arquivoweb/] rewrite new.htm -&gt; old.htm
  [rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] add per-dir prefix: old.htm -&gt; D:/dev/www/estadao/arquivoweb/old.htm
  [rid#2006ee0/initial] (2) [per-dir D:/dev/www/estadao/arquivoweb/] strip document_root prefix: D:/dev/www/estadao/arquivoweb/old.htm -&gt; /arquivoweb/old.htm
  [rid#2006ee0/initial] (1) [per-dir D:/dev/www/estadao/arquivoweb/] internal redirect with /arquivoweb/old.htm [INTERNAL REDIRECT]
  [rid#200fa90/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/old.htm -&gt; old.htm
  [rid#200fa90/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^old\.htm$' to uri 'old.htm'
  [rid#200fa90/initial/redir#1] (2) [per-dir D:/dev/www/estadao/arquivoweb/] rewrite old.htm -&gt; file.php?/arquivoweb/old.htm
  [rid#200fa90/initial/redir#1] (3) split uri=file.php?/arquivoweb/old.htm -&gt; uri=file.php, args=/arquivoweb/old.htm
  [rid#200fa90/initial/redir#1] (3) [per-dir D:/dev/www/estadao/arquivoweb/] add per-dir prefix: file.php -&gt; D:/dev/www/estadao/arquivoweb/file.php
  [rid#200fa90/initial/redir#1] (2) [per-dir D:/dev/www/estadao/arquivoweb/] strip document_root prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; /arquivoweb/file.php
  [rid#200fa90/initial/redir#1] (1) [per-dir D:/dev/www/estadao/arquivoweb/] internal redirect with /arquivoweb/file.php [INTERNAL REDIRECT]
  [rid#20e6c70/initial/redir#2] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; file.php
  [rid#20e6c70/initial/redir#2] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^old\.htm$' to uri 'file.php'
  [rid#20e6c70/initial/redir#2] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/file.php -&gt; file.php
  [rid#20e6c70/initial/redir#2] (3) [per-dir D:/dev/www/estadao/arquivoweb/] applying pattern '^new\.htm$' to uri 'file.php'
  [rid#20e6c70/initial/redir#2] (1) [per-dir D:/dev/www/estadao/arquivoweb/] pass through D:/dev/www/estadao/arquivoweb/file.php
  </code></pre>