添加 cname 而不放置子域名

添加 cname 而不放置子域名

我想将 www.example.com 或 example.com 指向 abc.example2.com。

在我的 example.com 的 cname 区域设置中,我添加了如下 cname:

名称:www.example.com 类型:cname 值:abc.example2.com

因此,当我访问 www.example.com 时,它会显示 abc.example2.com 的内容,这是绝对正确的。但是当我访问 example.com(没有 www 或任何其他子域)时,它不起作用。我甚至尝试添加如下记录集:

名称:example.com 类型:cname 值:abc.example2.com

但它在两个不同的 DNS 托管网站上给出了以下错误:Route 53

RRSet of type CNAME with DNS name example.com. is not permitted at apex in zone example.com.

动态域名系统

CNAME cannot be created with label that is equal to zone name or in use for another record type.

现在,如何实现访问 example.com 时显示 abc.example2.com 的内容?

答案1

当标签(名称)是 CNAME 时,不允许其他记录。所以你不能有类似的东西:

www.example.com  A     1.2.3.4
www.example.com  CNAME test.example.com.

这样做的效果是,你可以绝不为裸 example.com 域名创建一个 CNAME,因为总是其他记录:至少有 SOA 记录和一个或多个 NS 记录,通常还有一个或多个 MX 记录。因此,这必须是 A 记录。

我通常会反过来做:将 www.example.com 设为 example.com 的 CNAME。

相关内容