Hi,
I've seen that a map keyword exists in NginX, but I'm wondering how to use it to realize multiple calls, with matched expressions, on the same map, in order to emulate the Apache RewriteMap feature.
According to the following Apache files :
vhosts
--------------------------------------------------------------------------------------------------------------
<VirtualHost mywebsite.com:8080>
DocumentRoot "..."
ServerName mywebsite.com
ServerAlias www.mywebsite.com
RewriteMap search-woman "txt:the/path/to/search-woman.conf"
<Directory "/var/www/mywebsite/">
...
Include "the/path/to/mywebsite.com.conf"
...
</Directory>
</VirtualHost>
search-woman.conf
--------------------------------------------------------------------------------------------------------------
short-hair &hairSizes[3]=1
medium-hair &hairSizes[4]=1
long-hair &hairSizes[5]=1
white-hair &hairColors[1]=1
blonde &hairColors[2]=1
brunette &hairColors[3]=1
grey-hair &hairColors[4]=1
black-hair &hairColors[5]=1
ginger &hairColors[6]=1
amber-eyes &eyeColors[1]=1
blue-eyes &eyeColors[2]=1
grey-eyes &eyeColors[3]=1
brown-eyes &eyeColors[5]=1
hazel-eyes &eyeColors[6]=1
red-eyes &eyeColors[7]=1
green-eyes &eyeColors[8]=1
mywebsite.conf
--------------------------------------------------------------------------------------------------------------
RewriteEngine on
...
RewriteRule ^/woman/([^/]+)/$ /index.php?page=search&sex[2]=1${search-woman:$1} [PT]
RewriteRule ^/woman/([^/]+)/([^/]+)/$ /index.php?page=search&sex[2]=1${search-woman:$1}${search-woman:$2} [PT]
RewriteRule ^/woman/([^/]+)/([^/]+)/([^/]+)/$ /index.php?page=search&sex[2]=1${search-woman:$1}${search-woman:$2}${search-woman:$3} [PT]
Urls of my OR search will look like :
http://www.mywebsite.com/woman/blonde/long-hair/blue-eyes/
http://www.mywebsite.com/woman/blonde/brunette/ginger/
The RewriteMap feature is very efficient in the way that if you have 100 rules, you are not forced to hand-write or generate the cartesian product (100x100 = 10 000 rules), which would overkill the server. Only the 100 rules are needed.
RewriteMap a very important feature to me.
The last to implement in order to evacuate definitively the Apache server.
BTW, I didn't find in the documentation an example on how to do several calls, with matched expressions, on the same map :O
Denis TRUFFAUT