nginx 配置求助

2020-04-28 14:33:21 +08:00
 lvming6816077

原本业务的页面时 http://www.abc.com/index.html 是一个纯静态服务,目录下也有 index.html 这个文件

但是后面将此服务改成了服务端渲染,服务端的第一个路由是 /

请问,如何通过 nginx 配置将原本的 http://www.abc.com/index.html 全部转发到 http://www.abc.com/

1380 次点击
所在节点    NGINX
4 条回复
rrfeng
2020-04-28 14:40:58 +08:00
rewrite /index.html / break;
cloverzrg2
2020-04-28 14:41:51 +08:00
server {
...
location /index.html {
return 301 https://$server_name/;
}
}
cloverzrg2
2020-04-28 14:42:54 +08:00
```
server {
...
location /index.html {
return 302 https://$server_name/;
}
}
```
lvming6816077
2020-04-28 14:51:17 +08:00
十分感谢!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/666918

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX