[edit] map

Syntax: map string $variable { ... }
Default:
Context: http
Reference: map


map defines the mapping table which will be used to set a variable.

The table has two columns, pattern and value.

Since 0.9.6, regular expressions can be used as patterns using a ~ prefix.

Since 1.0.4, case insensitive regular expressions can be used by prefixing the pattern with ~*.

map $uri $myvalue {
    /aa                   /mapped_aa;
    ~^/aa/(?P<suffix>.*)$  $suffix;
}

If you need to have a tilde to start the pattern but not have it be a regular expression, the pattern can be prefixed with a backslash ('\'):

map $http_referer $myvalue {
    Mozilla    1234;
    \~Mozilla  5678;
}

There are three special parameters:

*.example.com  1; 

Instead of two entries

example.com    1;
*.example.com  1;

we can use only one

.example.com   1;

Module: HttpMapModule