I'm using nginx version 1.4.6.
I'm having trouble getting map
to work. I have something like this:
http {
map $arg_f $forum {
default 0;
1 2;
}
# ...
server {
# ...
location = /old.php {
if ($forum) {
return 301 /forums/$forum/;
}
return 494;
}
# ...
}
# ...
}
Here's what I get with nginx -t
:
nginx: [emerg] unknown "forum" variable
The goal is to map old URIs to new URIs. The catch is that some of the numeric forum IDs have changed. I'd like to handle this in Nginx, so I'm willing to resort to lua if there's no other easy way. I'm open to alternative solutions as long as they're elegant, but I'd like to know why map
isn't working here. Is it because the rewrite module doesn't query maps, at least in 1.4?