NGINX / Apache RewriteMap

时间:2013-07-09 08:55:18

标签: apache nginx rewritemap

我想知道如何在NGINX中翻译Apache“RewriteMap”指令。

我在NGINX在线文档中找不到任何内容

我当前的apache代码是:

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> 

任何想法?

1 个答案:

答案 0 :(得分:4)

检查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/;
}