amazon-web-servicesamazon-s3dnsnameservers

Is there a way to create an S3 static website on the main domain name & not the www subdomain?


I created a static website using an aws s3 bucket named www.example.com and linked to a godaddy domain via Route 53. Also created a bucket named example.com that redirects to the www.example.com. All good on that side.

However when I go directly to example.com (without the www), the website doesn't come up (Error is: DNS_PROBE_FINISHED_NXDOMAIN). However, when I go to www.example.com first and then example.com, that seems to do it - I believe the browser is able to read from the cache?

Is there a way to make sure example.com is reachable directly?

I thought about doing things the other way round - that is, using example.com bucket as the main website and www.example.com as for redirect, but I can't seem to find any tutorials where it's done this way. Everyone seems to include the subdomain www. in the bucket name

Is that because it's impossible to do it that way?


Solution

  • I thought about doing things the other way round - that is, using example.com bucket as the main website and www.example.com as for redirect

    Should not cause any issues. Even i am using s3, r53 for static website hosting. My bucket name is www.mydomain.com

    However, I have also used cloudfront for better distribution. So whenever i type mydomain.com it opens my webpage.

    Maybe create a record in your route53 to redirect example.com to www.expample.com?