[英]redirect to different location based on $uri in nginx
I would like to redirect to different page if there is request params present: 如果存在请求参数,我想重定向到其他页面:
http://domain.com --> index.html
http://domain.com/1 --> return 301 https://$host$request_uri;
current config: 当前配置:
server {
listen 80;
include /etc/nginx/mime.types;
location / {
#return 301 https://$host$request_uri;
root /usr/share/nginx/html;
}
}
How can I redirect to locations based on uri? 如何基于uri重定向到位置?
Try with the following: 请尝试以下操作:
...
location = / {
return 301 http://$host/index.html
}
location ~ ^/1 {
return 301 https://$host/$1
}
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.