So I have a .htaccess file which is performing a rewrite from /testscript1.php/testvar1/testvar2 to
/testscript2.php/testvar3/testvar4
(this is an over simplification but you get the idea).
Now though in my testscript2.php script when i access the $_SERVER[‘REQUEST_URI’] variable i see /testscript1.php/testvar1/testvar2 rather than /testscript2.php/testvar3/testvar4 which is what I am looking for. i.e $_SERVER[‘REQUEST_URI’] contains the uri before the rewrite.
My question is simply, is there a way to access the rewritten uri?
Try using
phpinfo()to get a view on what$_SERVERlooks like on a rewritten page. Apache supplies quite a lot of info that may be useful.On my test server, I get the following which may help you:
I would expect that at least one or a combination of those should be able to reliably give you the information you’re looking for.
Cheers.