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