httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Csaba Gabor <csaba2...@yahoo.com>
Subject Example of modifying and output of Environment to Header
Date Tue, 11 Dec 2001 06:42:45 GMT
Environment variables seem to be fleeting creatures at times.  Here now, gone at log time.
 Or
maybe I want to alter it by means of a regular expression even though apache only allows fixed
values for the most part.

Here's an example of how I remember an environment variable's value to a Header field that
handles the above ideas:

# This section copies a variable, and then place it into the header for non empty variables
# The next line saves the environment variable SCRIPT_URI to %1
RewriteCond %{ENV:SCRIPT_URI} (.*)
# The next line saves it to TestVar and continues.
# If I don't want to do anything with empty values I could use (^?.*$) or something similar
above
RewriteRule .* - [C=1,E=TestVar:%1]
# This again saves the same environment variable to %1
RewriteCond %{ENV:TestVar} (.*)
# The next part again works with the pieces collected from the RewriteCond line.
RewriteRule .* - [E=NewVar:The\ Value\ is\:\ %1]
# Finally, set the header MyHeaderTest to the newly constructed value
# provided the original variable was not empty
Header set MyHeaderTest %{NewVar}e env=TestVar



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message