apache - NGINX/Apache 重写映射

标签 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> 

有什么想法吗?

最佳答案

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

关于apache - NGINX/Apache 重写映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17543958/

相关文章:

apache - 在 Curator 重试尝试时处理来自 ZooKeeper 的 EndOfStreamException?

apache - 基于子路径反向代理两台服务器

apache,允许文件名带有 '?'

.net - 在 linux 和 apache 上的同一个 EC2 中运行多个 dotnet api 的项目

ubuntu - 直接从ip地址访问时删除默认的nginx欢迎页面

github - 为 nginx 用户添加 SSH-Key (for github)

regex - 如何在rewritecond中匹配www和非www?

Nginx上游负载均衡: auto retrying of 502's?

.htaccess - mod_rewrite 发送与重写映射不匹配的所有内容