[英]NGINX redirect from old to new domain
我需要将http://domain.com/?part=word
请求重定向到http://another_domain/?part=word
,“ word”可能有所不同
我的nginx配置:
server {
listen 80;
server_name domain.com www.domain.com;
rewrite ^/?part=(.*)$ http://another_domain/?part=$1 permanent;
}
重定向不起作用,我在做什么错?
无需指定要处理的单词,只需告诉nginx附加所有args
server {
listen 80;
server_name old.example.com;
return 301 http://new.example.com$request_uri;
}
更新:
我最近发现$request_uri
已经包含查询字符串,因此不需要使用多余的部分( $is_args$query_string
)。 我已经更新了上面的部分,并删除了多余的查询字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.