I'm using nginx and its map module (http://wiki.nginx.org/HttpMapModule) to create rewrites depending on $args value.
My config looks like the following:
nginx.conf
map $args $myvar {
default 0;
include /path/to/file.conf;
}
file.conf has something like:
foo=1 /url1;
foo=2 /url2;
....
foo=n /urln;
afterwards I'm using $myvar for redirects like this
location = /somepage.html {
if ($myvar !~ 0) {
rewrite ^ $myvar? permanent;
}
rewrite ^ /mydefaultpage/? permanent;
}
The question is: can I use regex inside my file.conf, which I include inside my map directive? So I could write something like
~^foo=1(&<suffix>.*)$ /url1?$suffix;
and thus preserve all other args when redirecting to /url1.
Thanks in advance for your help!