首页 > amazon-web-services > 重定向/忽略S3 index.html

重定向/忽略S3 index.html (Redirecting/Ignoring S3 index.html)

问题

有没有办法在S3上使用主子文件夹而无需在该存储桶的URL之后附加/index.html?

例如,我的存储区URL是https://s3.amazonaws.com/hello/,但是这显示了“拒绝访问”错误,我需要输入/index.html才能查看它。

有可能以某种方式删除index.html的需要和/或重定向它,以便我的主URL将是子文件夹?EG:如果我访问https://s3.amazonaws.com/hello/它可以工作,并显示index.html文件(但没有文件名,就像在'常规'Linux类型服务器上发生的那样)。

解决方法

您可以定义默认页面,但仅当您为静态网站共享配置存储桶时,这也会导致URL格式略有不同。

Amazon S3上的静态网站共享

URL看起来像:

<bucket-name>.s3-website-<AWS-region>.amazonaws.com/hello

请参阅:在Amazon S3上托管静态网站

问题

Is there a way to utilize the main subfolder on S3 without the need to append the /index.html after the URL of that bucket?

For example my bucket URL is https://s3.amazonaws.com/hello/, however this shows a Access Denied error, and I need to enter /index.html to view it.

Is it possible to somehow remove the need for index.html and/or redirect it, so that my main URL will be the subfolder? EG: if I access https://s3.amazonaws.com/hello/ it works, and shows the index.html file (but without the filename, as would happen on a 'regular' Linux type server).

解决方法

You can define a default page, but only if you configure the bucket for Static Website Sharing, which also results in a slightly different URL format.

Static Website Sharing on Amazon S3

The URL would look like:

<bucket-name>.s3-website-<AWS-region>.amazonaws.com/hello

See: Hosting a Static Website on Amazon S3

相似信息