I'm trying to access GET parameters from mod_rewrite.

E.g., given this URL: http://myserver.com/foo.png?foo=bar

The following rule does not catch this URL:

RewriteCond %{REQUEST_URI} bar [NC]

While this one does:

RewriteCond %{THE_REQUEST} bar [NC]

Doesn't REQUEST_URI include GET parameters? Is THE_REQUEST the way to go?

link|improve this question

72% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Yes, THE_REQUEST is the way to go as it will contain the entire http request with the following stipulation:

THE_REQUEST
The full HTTP request line sent by the browser to the server (e.g., "GET /index.html HTTP/1.1"). This does not include any additional headers sent by the browser.
link|improve this answer
I looked at the documentation, but I interpreted it to mean REQUEST_URI would contain the GET parameters. Oh well. – ripper234 Nov 6 '11 at 15:56
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.