## The

Syntax: BrowserMatch regex envar[=value] [...]
Default: none
Context: server config
Override: none
Status: Base
Module: mod_setenvif
Compatibility: Apache 1.2 and above (in Apache 1.2 this directive was found in the now-obsolete mod_browser module)

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. `!varname`, or
3. `varname=value`

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