I have a rewrite in nginx or Apache for this address:
http://domain.com/hello
to a script like
http://domain.com/test.php&a
You can usually find the requested URL in
$_SERVER['REQUEST_URI']$_SERVER['REDIRECT_URL'] (maybe Apache only, don't know about nginx)I know you mentioned $_SERVER['REQUEST_URI'] contains your rewritten URL but in all my tests, it contains the original request.
Why don't you dump $_SERVER and see what's in there.