Forum Moderators: phranque
There is a difference, though, in the meaning of the two variables: THE_REQUEST is the exact request header as originally received from the client. It is not 'updated' by any internal rewrites (e.g. mod_rewrite, mod_dir, mod_speling, etc.).
REQUEST_URI is basically the same thing as the URL-path 'seen' by RewriteRule. It *is* updated by any internal rewrites that occur previous to the RewriteRule or RewriteCond referencing it.
So, the two variables contain different information:
THE_REQUEST: GET /page.php?name1=value1&name2=value2 HTTP/1.1
REQUEST_URI: /page.php
THE_REQUEST is quite useful for testing for un-decoded characters, blank query strings ("?" followed by nothing), checking the requested URL *and* the query string (and possibly the HTTP method and protocol version as well) all together in one operation, and in determining if the REQUEST_URI/RewriteRule URL has already been rewritten within the context of the current HTTP request.
This latter function is critical in preventing loops when rewriting friendly URLs to internal script filepaths and at the same time trying to redirect old unfriendly URLs to the new friendly ones. This is impossible without using THE_REQUEST.
Jim