Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Per Amazon's instructions on hosting a static site on S3, I set my testing site up with two buckets: mydomain.tld and www.mydomain.tld. Per the instructions, the www bucket is configured to redirect to the top level bucket. In Route 53, the main domain is set as an A record alias for the mydomain.tld S3 endpoint, and www.mydomain.tld is a CNAME to the www bucket endpoint. That all works as expected — traffic to the www domain is redirected to the non-www, and the URL is rewritten accordingly.

However I was playing around with the configuration (partly because it seemed a bit unnecessary, and partly because I just wanted to see what would happen), and it looks like the second bucket is pretty much unnecessary. I removed the www bucket, and changed the DNS for the www subdomain to be an A record alias to the non-www endpoint, and it all seems to work as expected.

Am I missing something? Is this going to fail horribly down the road, or are Amazon's instructions just outdated and/or overly complicated? All I want is to redirect www.mydomain.tld to mydomain.tld, which the simpler setup seems to do just fine.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

There's no reason why having two A records won't work as you describe it, but the instructions are good practice because you should decide which is the canonical address of your site, www.domain.com or domain.com and redirect to the canonical name. Using two A records will make the site visible at both addresses.

Apart from the aesthetic considerations, this is particularly important for Search Engine Optimization (SEO) purposes as some search engines will treat your site as duplicate content if it visible at two domains.

By doing the redirect, visitors will be redirected with a HTTP 301 Moved Permanently if they go to the other URL and search engines will see that this is just an alias for your main site.

share|improve this answer
    
Thanks, very helpful information. Does the same apply if I used a CNAME record rather than a duplicate A record? –  robmathers Jun 10 '13 at 4:51
    
You can't use a CNAME for a root Top Level Domain like example.com but you could point www.example.com to the endpoint of your S3 bucket with a CNAME if you prefer. –  ianjs Jun 22 '13 at 10:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.