Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 相当于Apache查询字符串规则的Nginx_.htaccess_Nginx_Woocommerce - Fatal编程技术网

.htaccess 相当于Apache查询字符串规则的Nginx

.htaccess 相当于Apache查询字符串规则的Nginx,.htaccess,nginx,woocommerce,.htaccess,Nginx,Woocommerce,我们最近为我们的一个WordPress站点迁移到了nginx服务器。我们在Cloudflare中遇到了一个问题,ajax请求的内容类型被修改,这导致了条带集成的问题,并且它没有呈现 我们用下面的代码修复了它 RewriteCond %{REQUEST_URI} \?wc-ajax=update_order_review$ Header set Content-Type text/html 在Nginx中尝试了以下代码 location ~ /?wc-ajax=update_order_revi

我们最近为我们的一个WordPress站点迁移到了nginx服务器。我们在Cloudflare中遇到了一个问题,ajax请求的内容类型被修改,这导致了条带集成的问题,并且它没有呈现

我们用下面的代码修复了它

RewriteCond %{REQUEST_URI} \?wc-ajax=update_order_review$
Header set Content-Type text/html
在Nginx中尝试了以下代码

location ~ /?wc-ajax=update_order_review$ {
  add_header Content-Type text/html;
}
不幸的是,它没有工作,也没有找到任何在Nginx中重写相同内容的解决方案。 你能帮我整理一下吗


提前感谢

您可以使用
$args
访问查询字符串(无
)和
$arg\u name
访问查询参数
名称

因此,您可以尝试:

location / {
   if ($arg_wc-ajax ~ "^update_order_review$") {
      add_header Content-Type text/html;
   }
}