【发布时间】:2016-06-21 08:40:49
【问题描述】:
我需要
/secure/token/timestamp/path/to/the/resource/
改写成这种格式:
/s/path/to/the/resource/?st=token&e=timestamp
我想做的是:
location /secure/(?<token>)/(?<timestamp>)/(?<path>) {
rewrite ^ /s/$path/?st=$token&e=$timestamp
}
但它显然不起作用。这种语法似乎不正确。我怎么能像这样玩 nginx 规则中的 url?
编辑: 现在尝试这样的事情:相同的结果:
location /secure/(.*)/(.*)/(.*) {
rewrite ^ /s/$3?st=$1token&e=$2timestamp;
}
【问题讨论】:
标签: mod-rewrite nginx rules