Welcome! Log In Create A New Profile


Re: Multipule Map modules

Francis Daly
November 07, 2011 05:14PM
On Mon, Nov 07, 2011 at 03:54:24PM -0500, token wrote:

Hi there,

> What i would like to do is like Apache is to use multiple map files and
> get the vars form them
> i have tried the following and can only get one value `$variable1`
> what is a rewrite to get `$variable1` and `$variable2` in one rewrite
> rewrite ^(^\/*)/(.*)$ /index.php?key1=$variable1&key2=$variable2 last;

I confess I'm not sure exactly what it is you are trying to do.

For certain urls, grab parts of the url and send them as-is within
QUERY_STRING to a php-processor? (In which case: doing the grabbing in
the location definition is probably easiest.)

Or grab parts of the url, and set other values in QUERY_STRING based
on the url parts? (In which case, matching on $uri at server level and
using the map-ped value within the location block is probably easiest.)

Or maybe something else?

> map $uri $variable1 {
> default 11;
> /sub 7;
> }
> map $uri $variable2 {
> default 78;
> /pep 23;
> }

The map documentation is at http://wiki.nginx.org/HttpMapModule#map
and there's an example of if/set/map in the thread at

And there are examples of php-without-rewrite around as well -- in the
location block, set "fastcgi_param SCRIPT_FILENAME" explicitly, as well
as fastcgi_pass.

Good luck,

Francis Daly francis@daoine.org

nginx mailing list
Subject Author Posted

Multipule Map modules

token November 07, 2011 12:42PM

Re: Multipule Map modules

António P. P. Almeida November 07, 2011 05:08PM

Re: Multipule Map modules

Francis Daly November 07, 2011 05:14PM

Re: Multipule Map modules

token November 08, 2011 12:20AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready