3

I would like to know how to translate Apache "RewriteMap" directives in NGINX.

I've found nothing in the NGINX online documentation

My current apache code is:

RewriteMap map-one txt:C:/map-one.txt
RewriteMap map-two txt:C:/map-two.txt

<Directory /> 
    Options All 
    AllowOverride All
    RewriteEngine On
    RewriteRule /MYSITE/PRODUCT/([A-Za-z0-9-]+)/([A-Za-z0-9-]+),([0-9]+).aspx /$1/$2/${map-two:$3}/${map-one:$3} [R=301,L]
</Directory> 

Any Idea ?

Caleb2000
  • 31
  • 1
  • 3

1 Answers1

4

Check Nginx HTTP Map Module

map $uri $new {
  default               http://www.domain.com/home/;

  /aa                   http://aa.domain.com/;
  /bb                   http://bb.domain.com/;
  /john                 http://my.domain.com/users/john/;
}
karlcow
  • 6,977
  • 4
  • 38
  • 72
  • Seems to have been some significant changes to the nGinx wiki. [Nginx HTTP Map Module](http://nginx.org/en/docs/http/ngx_http_map_module.html) – so_ Nov 02 '15 at 19:39