REQUEST_URI should always have the requested doc...
Example, in my .htaccess i have a line
ErrorDocument 404 /path/notfound.php
And in notfound.php, $REQUEST_URI always returns the document that was not found.
I am not sure if the behaviour is different when PHP is running as CGI...Maybe that's your problem.