从conf文件中摘录
server {
#HTTP SITE
listen 80;
server_name example.tv www.example.tv;
#Redirect HTTP to HTTPS
location / {
return 301 https://example.tv$request_uri;
}}我想把https://example.com/?_=任何_字符串_这里重定向到google.com
这能在nginx上实现吗?
发布于 2018-09-01 10:03:20
server {
listen 443;
server_name 'www.example.net';
if ($arg__) {
return 301 https://www.google.com;
}
}这将将www.example.com/?_=Something重定向到https://www.google.com,但是www.example.com/?_=不会重定向,因此您需要使用如下所示:if ($args ~ _),但要注意,它将重定向包含_的所有东西,即www.example.com?param_1=5
(我找到了大部分信息这里)
https://serverfault.com/questions/928951
复制相似问题