设置foobar.com和www.foobar.com指向我的Amazon S3托管网站我的、网站、com、foobar

2023-09-11 08:41:16 作者:另觅良人

我有托管亚马逊S3网站;网址是像 www.foobar.com.s3-website-us-east-1.amazonaws.com 。我想设置我的域名注册商(NameCheap)重定向到两个 foobar.com www.foobar.com 来这个网站。设置记录

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.

工作正常的 WWW 子域。但是,我不知道如何配置站点的无子域的版本。我试过

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.

但似乎并没有工作。 (并没有我听说的CNAME不应该这样使用?)我知道,S3 bucket名称应该是等同于完全合格的DNS名称,但是这是否真的意味着我需要镜我在两个不同的桶网站的内容?我觉得必须有比这更好的解决方案。

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 than that.

谢谢!

推荐答案

您不能起到域顶点从S3托管网站的内容。最简单的办法是配置你的域名,这样foobar.com重定向到www.foobar.com。不幸的是这需要你有一个重写规则运行一个HTTP服务器来执行它。

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.

我不能保证亲自为服务,但 http://www.wwwizer.com/ 报价免费顶点到www重定向服务。

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

 
精彩推荐
图片推荐