如何设置Cloudfront和S3以指向每个路由的index.html?

2023-11-29

我有一个托管在 AWS 上的 NextJS 应用程序。我的文件夹结构是这样的:

- index.html

- /articles
-- index.html

-- /article1
---- /index.html

-- /article2
---- /index.html
.
.
.

如何将路由设置为/articles指向/articles/index.html,/article1指向/article1/index.html等等。我的应用程序中的每个文件夹都有一个相应的 /index.html。我已经在 S3 上托管了我的一侧,并且正在使用 cloudfront。我已经尝试将默认根对象设置为 /index.html 但看起来它只为根/域设置它,而不是子文件夹。

Thanks.


您不需要 Cloudfront 功能。以下 S3 设置将 index.html 设置为所有文件夹的默认值,而不仅仅是根文件夹。

enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何设置Cloudfront和S3以指向每个路由的index.html? 的相关文章

随机推荐