0

如果我有一个看起来像这样的位置块

location ~^ /foo/ { ... }

我收到一个对'/foo/bar'的请求,我怎么才能得到'bar'?

4

1 回答 1

0
location ~ ^/foo/.*/?([^/]+)$
{
    set $doc $1;
    ...
}

The above assumes you want the very last part if the request, below the foo path.

If you just want the second part:

location ~ ^/foo/(.*)$
{
    set $doc $1;
}
于 2013-04-24T06:43:38.980 回答