From: Ken Coar Date: Tue, 26 Aug 1997 16:43:12 +0000 (+0000) Subject: Ta-daah! The documentation for mod_setenvif, which defines the X-Git-Tag: APACHE_1_3b1~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=930bdc0c8dbe740a86fdbadb1713ca8cf355fce4;p=apache Ta-daah! The documentation for mod_setenvif, which defines the SetEnvIf* and BrowserMatch* directives. (And in time for 1.3b1, too) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@79088 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_setenvif.html b/docs/manual/mod/mod_setenvif.html new file mode 100644 index 0000000000..d089fa37db --- /dev/null +++ b/docs/manual/mod/mod_setenvif.html @@ -0,0 +1,275 @@ + + + + Apache module mod_setenvif + + + + +

Module mod_setenvif

+

+ This module is contained in the mod_setenvif.c file, and + is compiled in by default. It provides for + the ability to set environment variables based upon attributes of the + request. +

+

Summary

+

+ The mod_setenvif module allows you to set environment + variables according to whether different aspects of the request match + regular expressions you specify. These envariables can be used by + other parts of the server to make decisions about actions to be taken. +

+

Directives

+ + +
+

The BrowserMatch Directive

+

+ Syntax: BrowserMatch regex envar[=value] [...] +
+ Default: none +
+ Context: server config +
+ Override: none +
+ Status: Base +
+ Module: mod_setenvif +
+ Compatibility: Apache 1.2 and above +

+

+ The BrowserMatch directive defines environment variables based on the + User-Agent HTTP request header field. The first argument + should be a POSIX.2 extended regular expression (similar to an + egrep-style regex). The rest of the arguments give the + names of variables to set, and optionally values to which they should + be set. These take the form of +

+
    +
  1. varname, or +
  2. +
  3. !varname, or +
  4. +
  5. varname=value +
  6. +
+

+ In the first form, the value will be set to "1". The second + will remove the given variable if already defined, and the third will + set the variable to the value given by value. If a + User-Agent string matches more than one entry, they will + be merged. Entries are processed in the order in which they appear, + and later entries can override earlier ones. +

+

+ For example: +

+
+    BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
+    BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
+    BrowserMatch MSIE !javascript
+  
+

+ Note that the regular expression string is + case-sensitive. For cane-INsensitive matching, see + the + BrowserMatchNoCase + directive. +

+

+ The BrowserMatch and BrowserMatchNoCase + directives are special cases of the + SetEnvIf + and + SetEnvIfNoCase + directives. The following two lines have the same effect: +

+
+   BrowserMatchNoCase Robot is_a_robot
+   SetEnvIfNoCase User-Agent Robot is_a_robot
+  
+ +
+

+ + The BrowserMatchNoCase Directive + +

+

+ Syntax: BrowserMatchNoCase regex envar[=value] [...] +
+ Default: none +
+ Context: server config +
+ Override: none +
+ Status: Base +
+ Module: mod_setenvif +
+ Compatibility: Apache 1.2 and above +

+

+ The BrowserMatchNoCase directive is semantically identical to + the + BrowserMatch + directive. However, it provides for case-insensitive matching. For + example: +

+
+    BrowserMatchNoCase mac platform=macintosh
+    BrowserMatchNoCase win platform=windows
+  
+

+ The BrowserMatch and BrowserMatchNoCase + directives are special cases of the + SetEnvIf + and + SetEnvIfNoCase + directives. The following two lines have the same effect: +

+
+   BrowserMatchNoCase Robot is_a_robot
+   SetEnvIfNoCase User-Agent Robot is_a_robot
+  
+ +
+

+ + The SetEnvIf Directive + +

+

+ Syntax: SetEnvIf attribute regex envar[=value] [...] +
+ Default: none +
+ Context: server config +
+ Override: none +
+ Status: Base +
+ Module: mod_setenvif +
+ Compatibility: Apache 1.3 and above +

+

+ The SetEnvIf directive defines environment variables + based on attributes of the request. These attributes can be the + values of various HTTP request header fields (see + RFC2068 + for more information about these), or of other aspects of the request, + including the following: +

+ +

+ Some of the more commonly used request header field names include + Host, User-Agent, and Referer. +

+

+ Example: +

+
+   SetEnvIf Request_URI "\.(gif)|(jpg)|(xbm)$" object_is_image
+   SetEnvIf Referer www\.mydomain\.com intra_site_referral
+  
+

+ The first will set the envariable object_is_image if the + request was for an image file, and the second sets + intra_site_referral if the referring page was somewhere + on the www.mydomain.com Web site. +

+ +
+

+ + The SetEnvIfNoCase Directive + +

+

+ Syntax: SetEnvIfNoCase + attribute regex envar[=value] [...] +
+ Default: none +
+ Context: server config +
+ Override: none +
+ Status: Base +
+ Module: mod_setenvif +
+ Compatibility: Apache 1.3 and above +

+

+ The SetEnvIfNoCase is semantically identical to the + SetEnvIf + directive, and differs only in that the regular expression matching is + performed in a case-insensitive manner. For example: +

+
+   SetEnvIfNoCase Host Apache\.Org site=apache
+  
+

+ This will cause the site envariable to be set to + "apache" if the HTTP request header field + Host: was included and contained Apache.Org, + apache.org, or any other combination. +

+ + + +