也许是一个愚蠢的问题,但我似乎无法为此找到好的文档或示例......
当您使用位置块来过滤传入的请求时,您是从匹配的位置还是从请求的开头进行重写?
一个例子:
location ^~ /category/ {
rewrite ^/category/paid-search-news/?$ /tag/paid-search permanent; # this,
rewrite ^paid-search-news/?$ /tag/paid-search permanent; # this,
rewrite paid-search-news/?$ /tag/paid-search permanent; # or this?
}
Run Code Online (Sandbox Code Playgroud)