简体   繁体   中英

How to remove index.html from url in S3 website hosting?

I have a directory like this:

/example.com/
  index.html
    foo/
      index.html

The index document is set to index.html , so when the url is https://example.com , it shows /example.com/index.html .

Also, I wanna show /example.com/foo/index.html when the url is https://example.com/foo .

How can I do this?

If you have activated Static Website Hosting on your S3 bucket, and have configured index.html as your default page, this will work automatically.

静态网站托管

To test this, I did the following:

  • Created a new bucket
  • Turned on Static Website hosting
  • Created a foo directory
  • Uploaded an index.html file to the foo directory and made it public
  • Copied the bucket URL from the Static Website Hosting page and appended /foo

It looked like:

http://my-bucket.s3-website-ap-southeast-2.amazonaws.com/foo

The index page came up just fine.

By the way, it redirected me to /foo/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM