[英]Want to redirect the server url to server/somestring through nginx
想通过 nginx.conf 将服务器 url 重定向到服务器 url/somestring。 在 nginx.conf 中的服务器标记内尝试 location /somestring{},没有用。 请建议我如何实现这一目标。
Nginx配置的示例,它允许重定向多个域。 您也可以使用类似的方法来重定向路径。
map $http_host $redirect_destination {
hostnames;
default where-to-go-by-default;
my-domain where-to-redirect-my-domain;
}
server {
listen 80;
location / {
return 301 https://$redirect_destination/some-path;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.