我想在 nginx 中阻止任何包含“作者”一词的 URL。
喜欢:
exmaple.com/author/exmple....
exmaple.com/?author=2/exmple....
exmaple.com/?author=4
exmaple.com/blog/?author=1
exmaple.com/blog/author/wellcome
.
.
.
我使用下面的代码,然后重新启动 nginx,但不适用于所有 URL。
location ~ author{
deny all;
}
我该怎么办?
我使用2条规则:
以下网址:
www.exmaple.com/author/exmple....
www.exmaple.com/blog/author/wellcome
我用:
location ~ author{
return 403;
}
对于以下网址:
www.exmaple.com/?author=2/exmple....
www.exmaple.com/?author=4
www.exmaple.com/blog/?author=1
我用
if ($request_uri ~* author ) {
return 403;
}