Taichi
Taichi

Reputation: 2587

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?

Upvotes: 1

Views: 2409

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269360

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

Static website hosting
(source: amazon.com)

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/.

Upvotes: 4

Related Questions