我正在尝试将整个虚荣域重定向到NGINX级别的主域的特定URL。我已经尝试了以下所有方法,但在所有情况下,域名都不会重定向到特定页面,而是重定向到顶级域名。
server {
listen 80;
listen 443;
server_name vanityurl.com www.vanityurl.com;
return 301 https://myrealurl.com/internal/landingpage/;
}
server {
listen 80;
listen 443;
server_name vanityurl.com www.vanityurl.com;
location / {
return 301 https://myrealurl.com/internal/landingpage/;
}
}
server {
listen 80;
listen 443;
server_name vanityurl.com www.vanityurl.com;
rewrite ^/$ https://myrealurl.com/internal/landingpage/ permanent;
rewrite ^/(.*)$ https://myrealurl.com/internal/landingpage/ permanent;
}
我已经单独尝试过这些内容并且都做了同样的事情,将我重定向到https://myrealurl.com/删除内部/目标网页/。