【发布时间】:2017-06-15 20:57:19
【问题描述】:
我正在尝试创建一组规则来匹配带有和不带有斜杠的 url
大多数答案都指向我使用类似的东西。
location /node/file/ {
rewrite ^/node/file/(.*)/(.*)$ /php/node-file.php?file=$1&name=$2;
rewrite ^/node/file/(.*)/(.*)/?$ /php/node-file.php?file=$1&name=$2; │
}
但这与结尾的斜杠 url 不匹配。
我如何编写一个匹配看起来像这样的 url 的规则
http://example.com/node/file/abcd/1234/
http://example.com/node/file/abcd/1234
【问题讨论】:
标签: nginx nginx-location