Hi, suppose we have the following PHP page "index.php":
<?
if (!isset($_GET['req'])) $_GET['req'] = "null";
echo $_SERVER['REQUEST_URI'] . "<br>" . $_GET['req'];
?>
and the following ".htaccess" file:
RewriteRule ^2.php$ index.php?req=%{REQUEST_URI}
RewriteRule ^1.php$ 2.php
Now, let's access "index.php". We get this:
/index.php
null
That's cool. Let's access "2.php". We get this:
/2.php
/2.php
That's cool too. But now let's have a look at "1.php":
/1.php
/2.php
So... we ask for "1.php", it silently redirects to "2.php" which silently redirects to "index.php?req=%{REQUEST_URI}", but here the "%{REQUEST_URI}" seems to be "2.php" (the page we're looking for after the first redirection) and the $_SERVER['REQUEST_URI'] is "1.php" (the original request).
Shouldn't these variables be equal? This gave me a lot of headaches today as I was trying to do a redirection based only on the original request. Is there any variable I can use in ".htaccess" that will tell me the original request even after a redirection?
Thanks in advance and I hope I've made myself clear. It's my first post here :)