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.
Here are my non-working rules:
RewriteRule ^old\.htm$ file.php?%{REQUEST_URI} [L]
RewriteRule ^new\.htm$ old.htm [L]
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.
Any ideas?
Here's RewriteLogLevel 3 output if it helps:
old.htm
[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/old.htm -> 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 -> file.php?/arquivoweb/old.htm
[rid#2006ee0/initial] (3) split uri=file.php?/arquivoweb/old.htm -> uri=file.php, args=/arquivoweb/old.htm
[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] add per-dir prefix: file.php -> 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 -> /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 -> 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 -> 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
new.htm
[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] strip per-dir prefix: D:/dev/www/estadao/arquivoweb/new.htm -> 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 -> 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 -> old.htm
[rid#2006ee0/initial] (3) [per-dir D:/dev/www/estadao/arquivoweb/] add per-dir prefix: old.htm -> 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 -> /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 -> 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 -> file.php?/arquivoweb/old.htm
[rid#200fa90/initial/redir#1] (3) split uri=file.php?/arquivoweb/old.htm -> 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 -> 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 -> /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 -> 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 -> 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