将 foobar.com 和 www.foobar.com 设置为指向我的 Amazon S3 托管站点 [英] Setting foobar.com and www.foobar.com to point to my Amazon S3–hosted site

查看:25
本文介绍了将 foobar.com 和 www.foobar.com 设置为指向我的 Amazon S3 托管站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Amazon S3 上托管了一个网站;URL 类似于 www.foobar.com.s3-website-us-east-1.amazonaws.com.我想将我的域名注册商 (NameCheap) 设置为将 foobar.comwww.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 存储桶名称应该与完全限定的 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.

这篇关于将 foobar.com 和 www.foobar.com 设置为指向我的 Amazon S3 托管站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆