Redirect 在nginx中重定向期间重命名特定查询参数
我希望将URL重定向到Redirect 在nginx中重定向期间重命名特定查询参数,redirect,nginx,Redirect,Nginx,我希望将URL重定向到/catalogsearch/result/?q=[keyword]到/products?keyword=[keyword]。遵循规则有什么问题 location ~ /catalogsearch/result/?q=(.*) { rewrite ^ /products?keyword=$1 permanent; } ?及其后的任何内容(查询字符串)不是位置和重写指令使用的规范化URI的一部分 假设只有一个参数,可以使用 location = /catalogse
/catalogsearch/result/?q=[keyword]
到/products?keyword=[keyword]
。遵循规则有什么问题
location ~ /catalogsearch/result/?q=(.*) {
rewrite ^ /products?keyword=$1 permanent;
}
?
及其后的任何内容(查询字符串)不是位置
和重写
指令使用的规范化URI的一部分
假设只有一个参数,可以使用
location = /catalogsearch/result/ {
return 301 /products?keyword=$arg_q;
}