NGINX重写位置而不更改网址

问题描述 投票:0回答:1

访问/abc/sitemap.xml时,我想在不更改网址的情况下显示/abc/sitemap?output=xml的内容。

目前,它显示正确的内容,但将URL更改为/ abc / sitemap?output = xml而不是保留/abc/sitemap.xml,这是我的配置。

location /abc/sitemap.xml {
    rewrite ^ /abc/sitemap?output=xml;
}

谢谢

nginx
1个回答
0
投票

怎么样的proxy_pass

location /abc/sitemap.xml {
    proxy_pass http://$host/abc/sitemap?output=xml;
}

注意:根据您的SSL配置,使用HTTPHTTPS

© www.soinside.com 2019 - 2024. All rights reserved.