GCP-静态托管-重定向到/index.html

Dan*_*tag 8 redirect google-cloud-storage google-cloud-platform

我正在尝试使用GCP和Google Cloud Storage为静态网站提供服务。我已经完成了此处指定的所有操作https://cloud.google.com/storage/docs/hosting-static-website

说我有以下文件结构:

- index.html
- folder
    - index.html
    - another.html
Run Code Online (Sandbox Code Playgroud)

我进入www.example.com/folder

它重定向到www.example.com/folder/index.html=> index.html是不希望的

但是,如果输入www.example.com/folder/,它不会重定向,并且透明地正确提供index.html页面。

如何防止出现第一种行为?还是自动添加斜杠?

谢谢!

N S*_*ngh 0

您应该能够相应地将MainPageSuffix设置为 index.html。有关更多信息,请查看公共文档链接中提供的附加说明。参考示例可以在同一文档中找到。

句法:

gsutil web set [-m main_page_suffix] bucket_url
Run Code Online (Sandbox Code Playgroud)