Naked Root Domain Hosting

85 views Asked by At

The usual approach calls for pointing mysite.com to www.mysite.com.

But suppose that I would like not to redirect. In other words, I would like to set up a naked root domain, without setting up any sub-domains, not even www.mysite.com.

I am using Route53 and S3. Presumably I would need just one hosted zone (mysite.com). Do I still need two buckets (mysite.com and www.mysite.com) or can I set up just mysite.com?

2

There are 2 answers

8
Michael - sqlbot On BEST ANSWER

Set up the bucket, named for your domain name. The bucket name has to match exactly the address that shows in the browser's address bar.

Then, create an A record at the root (apex) of the domain in Route 53, leaving the hostname empty, selecting "Yes" for Alias, then select the bucket in the drop down list.

That is all you have to do.

If you create a "www" CNAME pointing to the domain name itself, this will not work with S3 web site hosting, because the bucket name won't match what's in the address bar of the browser (and a CNAME does not cause the browser to change the address bar to the target).

Everything in DNS that points to S3 must have a corresponding bucket that matches the DNS entry. That's how it was designed.

Because people are often very prone to typing "www" in front of web site hostnames, you probably should create a second bucket with "www."+your domain name as the bucket name, then configure that bucket to redirect all requests to the root domain name, and set an additional Alias record on S3 -- because that way if a user types "www.example.com" into their browser, it will hit the second bucket and redirect -- by changing the browser's address bar -- to the root domain... which almost certainly is what you actually want, from a usability perspective.

5
greg_diesel On

Edit after some testing on one of my extra domains. The information posted below is incorrect. I'll leave this here so others don't follow down this incorrect path.

--------------------------------


That's what CNAME records do for you. Just add a CNAME for 'www' that goes to yourdomain.com

Both www.yourdomain.com and yourdomain.com will work in the browser without any redirection.

in Route53 it will look like this.
enter image description here