Name
SetEnvIf
Synopsis
SetEnvIfattribute
regex
var
[=value
]var
[=value
]
[server config]
Sets environment variables based on the attributes of an HTTP request. Some of the more common attributes are:
-
Remote_Host
The hostname of the client, if known
-
Remote_Addr
The IP address of the client
-
Remote_User
The user which is making the request, if known
-
Request_Method
The name of the HTTP method being used to request information
-
Request_URI
The latter portion of the URL, after the host information
-
Referer
The URI of the referring page, if known
For example, the following sets the environment variable
SOMEONE_FROM_OREILLY
if the remote host resolves
to the domain oreilly.com:
SetEnvIf Remote_Host oreilly.com SOMEONE_FROM_OREILLY
Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.