Next.js - 部署静态输出时没有 .html 扩展名的 404 错误

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

我的网站使用 Next.js 并使用 FileZilla 进行静态输出部署。

我可以在没有

.html
扩展名的情况下到达网站的根目录,如下所示:

https://www.mywebsite.com

当我尝试访问服务器上的任何其他页面时,除非我提供

.html
扩展名,否则我会收到 404 错误。

不起作用:

https://www.mywebsite.com/en/marine/modelvirtue

作品:
https://www.mywebsite.com/en/marine/modelvirtue.html

当我使用 VSCode 在开发模式下运行项目时,不会发生这种情况。

html next.js webserver static-pages
1个回答
0
投票

trailingSlash: true
添加到
next.config.js
应该可以解决此问题。

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