开发者

Setting foobar.com and www.foobar.com to point to my Amazon S3–hosted site

I have a website hosted at Amazon S3; the URL is something like www.foobar.com.s3-website-us-east-1.amazonaws.com. I would like to set my domain registrar (NameCheap) to redirect both foobar.com and www.foobar.com to this website. Setting the record

www.foobar.com CNAME www.foobar.com.s3-website-us-east-1.amazonaws.com.

works fine for the www subdomain. However, I can’t figure out how to configure the no-subdomain version of the site. I tried

foobar.com CNAME www.foobar.com.s3-website-us-east-1.amazonaws.com.

but that doesn’t seem to work. (And did I read somewhere that CNAMEs aren’t supposed to be used like this?) I know that the S3 bucket name is supposed to be identical to the fully-qualified DNS name, but does this really mean that I need to mirror my website contents in two different buckets? I feel like there must be a better solution t开发者_如何学Pythonhan that.

Thanks!


You cannot serve "domain apex" content from S3-hosted websites. The easiest solution is to configure your domain such that "foobar.com" is redirected to "www.foobar.com". Unfortunately this requires you to run a HTTP server with a rewrite rule to enforce it.

I can't vouch personally for the service but http://www.wwwizer.com/ offers a free apex to www redirect service.


It looks like AWS S3 added bucket redirection around the end of 2012 to allow support for www.foobar.com and foobar.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜