mod_setenvif.html revision 2de56243b49d1c39dbc467e3f9daab152c8691b8
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski This file is generated from xml source: DO NOT EDIT
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski --><title>mod_setenvif- Apache HTTP Server</title><link href="/style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_setenvif</h1><table cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Allows the setting of environment variables based
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowskion characteristics of the request</td></tr><tr><td><a href="module-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="module-dict.html#ModuleIdentifier" class="help">Module&nbsp;Identifier:</a></td><td>setenvif_module</td></tr><tr><td align="left" valign="top"><a href="module-dict.html#Compatibility" class="help">Compatibility:</a></td><td><compatibility>Available in Apache 1.3 and later</compatibility></td></tr></table></td></tr></table><h2>Summary</h2>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>The <code><a href="mod_setenvif.html">mod_setenvif</a></code> module allows you to set
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski environment variables according to whether different aspects of
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski the request match regular expressions you specify. These
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding environment variables can be used by other parts of the server
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski to make decisions about actions to be taken.</p>
781d04c5e02635caed8b98f0adcf559f9426a39cTill Mossakowski
781d04c5e02635caed8b98f0adcf559f9426a39cTill Mossakowski <p>The directives are considered in the order they appear in
781d04c5e02635caed8b98f0adcf559f9426a39cTill Mossakowski the configuration files. So more complex sequences can be used,
781d04c5e02635caed8b98f0adcf559f9426a39cTill Mossakowski such as this example, which sets <code>netscape</code> if the
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder browser is mozilla but not MSIE.</p>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder BrowserMatch ^Mozilla netscape<br>
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder BrowserMatch MSIE !netscape<br>
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder</code></td></tr></table></blockquote>
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder<h2>Directives</h2><ul><li><a href="#browsermatch">BrowserMatch</a></li><li><a href="#browsermatchnocase">BrowserMatchNoCase</a></li><li><a href="#setenvif">SetEnvIf</a></li><li><a href="#setenvifnocase">SetEnvIfNoCase</a></li></ul><p><strong>See also </strong></p><ul><li><a href="/env.html">Environment Variables in Apache</a></li></ul><hr/><h2><a name="BrowserMatch">BrowserMatch</a> <a name="browsermatch">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets environment variables conditional on HTTP User-Agent
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>BrowserMatch <em>regex env-variable</em>[=<em>value</em>]
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski[<em>env-variable</em>[=<em>value</em>]] ...</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_setenvif</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Apache 1.2 and
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski above (in Apache 1.2 this directive was found in the
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski now-obsolete mod_browser module)</td></tr></table></td></tr></table>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>The <code class="directive">BrowserMatch</code> directive defines
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder environment variables based on the <code>User-Agent</code> HTTP
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder request header field. The first argument should be a POSIX.2
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder extended regular expression (similar to an
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <code>egrep</code>-style regex). The rest of the arguments give
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder the names of variables to set, and optionally values to which they
c74040e2ca9d0534d0c4244f69a3e76a01341f05Klaus Luettich should be set. These take the form of</p>
c74040e2ca9d0534d0c4244f69a3e76a01341f05Klaus Luettich
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder <ol>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <li><code><em>varname</em></code>, or</li>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code>!<em>varname</em></code>, or</li>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code><em>varname</em>=<em>value</em></code></li>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski </ol>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>In the first form, the value will be set to "1". The second
05ca76b03b6d16bcfb3e7654c31e41a220e85663Till Mossakowski will remove the given variable if already defined, and the
05ca76b03b6d16bcfb3e7654c31e41a220e85663Till Mossakowski third will set the variable to the value given by
31c49f2fa23d4ac089f35145d80a224deb6ea7e4Till Mossakowski <code><em>value</em></code>. If a <code>User-Agent</code>
31c49f2fa23d4ac089f35145d80a224deb6ea7e4Till Mossakowski string matches more than one entry, they will be merged.
31c49f2fa23d4ac089f35145d80a224deb6ea7e4Till Mossakowski Entries are processed in the order in which they appear, and
31c49f2fa23d4ac089f35145d80a224deb6ea7e4Till Mossakowski later entries can override earlier ones.</p>
05ca76b03b6d16bcfb3e7654c31e41a220e85663Till Mossakowski
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>For example:</p>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski BrowserMatch ^Mozilla forms jpeg=yes browser=netscape<br>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript<br>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski BrowserMatch MSIE !javascript<br>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder</code></td></tr></table></blockquote>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <p>Note that the regular expression string is
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <strong>case-sensitive</strong>. For case-INsensitive matching,
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder see the <a href="#browsermatchnocase" class="directive"><code class="directive">BrowserMatchNoCase</code></a>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding directive.</p>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder
59fa9b1349ae1e001d996da732c4ac805c2938e2Christian Maeder <p>The <code class="directive">BrowserMatch</code> and
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <code class="directive">BrowserMatchNoCase</code> directives are special cases of
59fa9b1349ae1e001d996da732c4ac805c2938e2Christian Maeder the <a href="#setenvif" class="directive"><code class="directive">SetEnvIf</code></a> and <a href="#setenvifnocase" class="directive"><code class="directive">SetEnvIfNoCase</code></a>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder directives. The following two lines have the same effect:</p>
59fa9b1349ae1e001d996da732c4ac805c2938e2Christian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski BrowserMatchNoCase Robot is_a_robot<br>
59fa9b1349ae1e001d996da732c4ac805c2938e2Christian Maeder SetEnvIfNoCase User-Agent Robot is_a_robot<br>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding</code></td></tr></table></blockquote>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder<hr/><h2><a name="BrowserMatchNoCase">BrowserMatchNoCase</a> <a name="browsermatchnocase">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets environment variables conditional on User-Agent without
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herdingrespect to case</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>BrowserMatchNoCase <em>regex env-variable</em>[=<em>value</em>]
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski [<em>env-variable</em>[=<em>value</em>]] ...</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_setenvif</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Apache 1.2 and
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder above (in Apache 1.2 this directive was found in the
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski now-obsolete mod_browser module)</td></tr></table></td></tr></table>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>The <code class="directive">BrowserMatchNoCase</code> directive is
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder semantically identical to the <a href="#browsermatch" class="directive"><code class="directive">BrowserMatch</code></a> directive.
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder However, it provides for case-insensitive matching. For
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski example:</p>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski BrowserMatchNoCase mac platform=macintosh<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder BrowserMatchNoCase win platform=windows<br>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding</code></td></tr></table></blockquote>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding <p>The <code class="directive">BrowserMatch</code> and
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <code class="directive">BrowserMatchNoCase</code> directives are special cases of
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder the <a href="#setenvif" class="directive"><code class="directive">SetEnvIf</code></a> and <a href="#setenvifnocase" class="directive"><code class="directive">SetEnvIfNoCase</code></a>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski directives. The following two lines have the same effect:</p>
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder BrowserMatchNoCase Robot is_a_robot<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder SetEnvIfNoCase User-Agent Robot is_a_robot<br>
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding</code></td></tr></table></blockquote>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski<hr/><h2><a name="SetEnvIf">SetEnvIf</a> <a name="setenvif">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets environment variables based on attributes of the request
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>SetEnvIf <em>attribute
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder regex env-variable</em>[=<em>value</em>]
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder [<em>env-variable</em>[=<em>value</em>]] ...</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_setenvif</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Apache 1.3 and
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski above; the Request_Protocol keyword and environment-variable
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski matching are only available with 1.3.7 and later</td></tr></table></td></tr></table>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>The <code class="directive">SetEnvIf</code> directive defines environment
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski variables based on attributes of the request. These attributes
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski can be the values of various HTTP request header fields (see <a href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC2616</a>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski for more information about these), or of other aspects of the
f6c04b8534762854072795add026d4551156a410Heng Jiang request, including the following:</p>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
f6c04b8534762854072795add026d4551156a410Heng Jiang <ul>
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang <li><code>Remote_Host</code> - the hostname (if available) of
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang the client making the request</li>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code>Remote_Addr</code> - the IP address of the client
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang making the request</li>
f6c04b8534762854072795add026d4551156a410Heng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code>Remote_User</code> - the authenticated username (if
f6c04b8534762854072795add026d4551156a410Heng Jiang available)</li>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code>Request_Method</code> - the name of the method
f6c04b8534762854072795add026d4551156a410Heng Jiang being used (<code>GET</code>, <code>POST</code>, <em>et
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang cetera</em>)</li>
f6c04b8534762854072795add026d4551156a410Heng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <li><code>Request_Protocol</code> - the name and version of
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang the protocol with which the request was made (<em>e.g.</em>,
f6c04b8534762854072795add026d4551156a410Heng Jiang "HTTP/0.9", "HTTP/1.1", <em>etc.</em>)</li>
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang <li><code>Request_URI</code> - the portion of the URL
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang following the scheme and host portion</li>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang </ul>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
f6c04b8534762854072795add026d4551156a410Heng Jiang <p>Some of the more commonly used request header field names
0d9160e906743b226d4768707f84151ab6c66253Heng Jiang include <code>Host</code>, <code>User-Agent</code>, and
f6c04b8534762854072795add026d4551156a410Heng Jiang <code>Referer</code>.</p>
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang <p>If the <em>attribute</em> name doesn't match any of the
f6c04b8534762854072795add026d4551156a410Heng Jiang special keywords, nor any of the request's header field names,
2f4ab3efb20e52aa207201ecc22ece1d4ccc655dHeng Jiang it is tested as the name of an environment variable in the list
f6c04b8534762854072795add026d4551156a410Heng Jiang of those associated with the request. This allows
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding <code class="directive">SetEnvIf</code> directives to test against the result of
f6c04b8534762854072795add026d4551156a410Heng Jiang prior matches.</p>
f6c04b8534762854072795add026d4551156a410Heng Jiang
f6c04b8534762854072795add026d4551156a410Heng Jiang<blockquote><table><tr><td bgcolor="#e0e5f5">
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <strong>Only those environment variables defined by earlier
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <code>SetEnvIf[NoCase]</code> directives are available for
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder testing in this manner. 'Earlier' means that they were
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski defined at a broader scope (such as server-wide) or
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski previously in the current directive's scope.</strong>
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder</td></tr></table></blockquote>
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder <p><em>attribute</em> may be a regular expression when used to
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski match a request header. If <em>attribute</em> is a regular
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski expression and it doesn't match any of the request's header
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder names, then <em>attribute</em> is not tested against the
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder request's environment variable list.</p>
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Example:</strong></p><code>
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski SetEnvIf Request_URI "\.gif$" object_is_image=gif<br>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski SetEnvIf Request_URI "\.jpg$" object_is_image=jpg<br>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder SetEnvIf Request_URI "\.xbm$" object_is_image=xbm<br>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski :<br>
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder SetEnvIf Referer www\.mydomain\.com intra_site_referral<br>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski :<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder SetEnvIf object_is_image xbm XBIT_PROCESSING=1<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder :<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder SetEnvIf ^TS* ^[a-z].* HAVE_TS<br>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder</code></td></tr></table></blockquote>
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <p>The first three will set the environment variable
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski <code>object_is_image</code> if the request was for an image
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski file, and the fourth sets <code>intra_site_referral</code> if
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder the referring page was somewhere on the
0e2ae85e2453466d03c1fc5884a3d693235bb9d9Christian Maeder <code>www.mydomain.com</code> Web site.</p>
c74040e2ca9d0534d0c4244f69a3e76a01341f05Klaus Luettich
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herding <p>The last example will set environment variable
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder <code>HAVE_TS</code> if the request contains any headers that
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder begin with "TS" whose values begins with any character in the
3a761fd74f4f3c5587a199553c0ee7383e5d8ff3Christian Maeder set [a-z].</p>
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowski<hr/><h2><a name="SetEnvIfNoCase">SetEnvIfNoCase</a> <a name="setenvifnocase">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets environment variables based on attributes of the request
2a693c01b154f1e25931ff6c754d2d02096e2662Till Mossakowskiwithout respect to case</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>SetEnvIfNoCase <em>attribute regex env-variable</em>[=<em>value</em>]
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder [<em>env-variable</em>[=<em>value</em>]] ...</td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_setenvif</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>Apache 1.3 and above</td></tr></table></td></tr></table>
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder <p>The <code class="directive">SetEnvIfNoCase</code> is semantically identical to
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder the <a href="#setenvif" class="directive"><code class="directive">SetEnvIf</code></a> directive,
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder and differs only in that the regular expression matching is
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder performed in a case-insensitive manner. For example:</p>
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder SetEnvIfNoCase Host Apache\.Org site=apache
d183a4514d8a5b6a5d48d15a8dff52d0c96691eaChristian Maeder</code></td></tr></table></blockquote>
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding
684ada8af5c3e6da5c1a69edb6f233c9f2db4ebdWiebke Herding <p>This will cause the <code>site</code> environment variable
to be set to "<code>apache</code>" if the HTTP request header
field <code>Host:</code> was included and contained
<code>Apache.Org</code>, <code>apache.org</code>, or any other
combination.</p>
<hr/></blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="/images/index.gif" alt="Index"/></a><a href="../"><img src="/images/home.gif" alt="Home"/></a></body></html>