更新时间:2023-11-27 16:10:04
整个查询字符串都出现在$args
变量中或$request_uri
变量的末尾.您将需要构造一个正则表达式来捕获要删除的部分之前和之后的所有内容.
The entire query string is present in the $args
variable or at the end of the $request_uri
variable. You will need to construct a regular expression to capture everything before and after the part you wish to delete.
例如:
if ($request_uri ~ ^(/something\?.*)\bunwanted=[^&]*&?(.*)$ )
{
return 301 $1$2;
}
See this document for more, and this caution on the use of if
.