大网数据广告活动
网站运营与故障问答

Creating an A record and then a CNAME to point a subdomain to a different server gives an error message

· 52CE 我爱测

I am trying to point a subdomain to a different server. The A Record changed without issue but the CNAME won't save in cPanel. I get this error: Error: sub.domain.com. already has a A record. You may not mix CNAME records with ot…

问题原文

原帖链接 · Henry · CC BY-SA 4.0

I am trying to point a subdomain to a different server. The A Record changed without issue but the CNAME won't save in cPanel.

I get this error:

Error: sub.domain.com. already has a A record. You may not mix CNAME records with other records for the same name.

How do I fix this?

社区高分解答

原帖链接 · x a · CC BY-SA 4.0

A and CNAME both are types of DNS records, that can be applied to a domain name.

But they are mutually exclusive:[1]

  • A resolves a domain name query to an IP address,
  • CNAME resolves it to an other domain name.

So if you are ”trying to point a subdomain to a different server“ it depends on you hosting situation if it's better to have DNS queries resolved directly to the new server's IP by setting the subdomain's A record to the new IP or "redirect" the DNS lookup by setting CNAME to point to a domain name of the new server (which gets DNS-resolved iteratively).[2]

(I certainly have no crystal ball, but person asking the question may confuse a CNAME record to be some kind of alias naming mechanism.)



  1. Actually, a domain name having a CNAME attached must not have any other resource record associated.
  2. NB: In the case of HTTP requests to the mentioned subdomain, the host: header will not change during a CNAME resolution.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-11-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。