This is a discussion on mod_rewrite carry over all environment variables within the Linux Web Servers forums, part of the Web Server and Related Forums category; I am doing a simple Apache mod_rewrite which rewrites a simple URL to a more complex script URL. I am ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am doing a simple Apache mod_rewrite which rewrites a simple URL to a
more complex script URL. I am also tracking the usage and trying to record the IP information of the request. The mod_rewrite rules I have are not keep the original environment variables including IP address and browser information. Does anyone know how I can keep the original environment variables and forward them to the new rewritten URL? Thanks, Scott |
|
|||
|
> I am doing a simple Apache mod_rewrite which rewrites a simple URL to a
> more complex script URL. I am also tracking the usage and trying to > record the IP information of the request. > > The mod_rewrite rules I have are not keep the original environment > variables including IP address and browser information. > > Does anyone know how I can keep the original environment variables and > forward them to the new rewritten URL? while i have some difficulties understanding how plain rewrite-rules (ie those without external redirects or reverse proxying) should fail to keep HTTP_USER_AGENT or REMOTE_ADDR env variables, one could take the sledgehammer approach of tagging on those values to the request in custom http headers: RequestHeader set X-My-User-Agent %{HTTP_USER_AGENT}e RequestHeader set X-My-Client-IP %{REMOTE_ADDR}e due to absence of a possibility to manipulate request headers and set dynamic header values in apache 1.3 this will work under apache2 only, though. btw, one can set the environment variable used as header value in a rewrite rule before, which allows for some really nifty tricks... joachim |