现在我有一个类似.htaccess的代码,如下所示:
RewriteCond %{QUERY_STRING} ^(.*)&?fbclid=[^&]+&?(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
RewriteCond %{QUERY_STRING} ^(.*)&?fb_action_ids=[^&]+&?(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
RewriteCond %{QUERY_STRING} ^(.*)&?fb_comment_id=[^&]+&?(.*)$ [NC]
RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]请帮我把它转换成nginx谢谢
发布于 2019-04-20 16:27:03
整个查询字符串都可以作为$args变量使用。您可以使用if语句测试该变量。
例如:
if ($args ~ ^(.*)&?fbclid=[^&]+&?(.*)$) {
return 301 $uri?$1$2;
}
if ($args ~ ^(.*)&?fb_action_ids=[^&]+&?(.*)$) {
return 301 $uri?$1$2;
}
if ($args ~ ^(.*)&?fb_comment_id=[^&]+&?(.*)$) {
return 301 $uri?$1$2;
}https://stackoverflow.com/questions/55771316
复制相似问题