Original link: https://www.williamlong.info/archives/6890.html
When the website server space is changed, the webmaster usually needs to modify the domain name resolution. Due to the different architectures between different service providers, in many cases, it is not the replacement of IP, but the replacement of IP by CNMAE or the replacement of CNAME by IP.
If you use the traditional method to migrate www from CNAME to A and directly add an A record, it will prompt that a CNAME record already exists. Users often need to perform a CNAME delete operation before performing another A addition operation. Due to the delay in the effective time of domain name resolution, It will cause the www domain name to fail to resolve for a period of time, ranging from a few minutes to one or two hours. This modification method has a bad experience.
A better smooth modification method is to use the @ and www records to resolve the website, @ uses the A record to resolve the IP address, and www uses the CNAME record to resolve the domain name. If you need to perform the change from CNAME to A, the modification method is: First, modify the A record of @ to the target IP address, and then resolve the CNAME of www to @, so that the CNAME of www can be resolved to an IP address.
Similarly, after the domain name is set, if you need to modify the A record to the CNAME record in the future, you can directly modify the CNAME of www to the target value.
In this way, when changing the content of www, it can be changed from CNAME to A. This CNAME migration method is not only fast, but also stable. When changing DNS, the domain name cannot be resolved.
Appendix: Related Knowledge
Domain name resolution: Domain name resolution is the process of converting a domain name to an IP address. An IP address is a digital address that identifies your website on the Internet. For simplicity and ease of memory, a domain name is used instead of an IP address to identify the site address. The resolution of the domain name is done by the DNS server.
A record: A record is used to specify the IP address record corresponding to the host name (or domain name). Users can point the website server under the domain name to their own web server. At the same time, you can also set the second-level domain name of the website domain name.
CNAME record: CNAME record, ie: alias record. This record allows webmasters to map multiple names to the same computer. Usually used for computers that provide both WWW and MAIL services. For example, there is a server that provides both WWW and MAIL services, in order to facilitate user access to services. Two aliases (CNAMEs) can be set up for this computer: WWW and MAIL.
This article is reprinted from: https://www.williamlong.info/archives/6890.html
This site is for inclusion only, and the copyright belongs to the original author.