我正尝试从mynewdomain.com
到mytenantsite.com/tenant.html#store/home
。
我尝试过以下变体:
server {
listen 80;
server_name *.mynewdomain.com;
return 301 $scheme://mytenantsite.com/tenant.html#store/home;
}
和
server {
listen 80;
server_name *.mynewdomain.com;
rewrite ^/$ mytenantsite.com/tenant.html#store/home last;
}
我也尝试过将永久设置为最后,但都发送到mytenantsite.com
,而不是发送到mytenantsite.com/tenant.html#store/home
答案1
这应该可行。丢掉通配符。
server {
listen 80;
server_name example.com www.example.com;
return 301 https://www.newdomain.com/whatever/path#location;
}