Support >
  About cybersecurity >
  How to configure DNS resolution during website migration?

How to configure DNS resolution during website migration?

Time : 2026-02-01 11:13:59
Edit : DNS.COM

  Website migration is a common task for many website owners. It might be due to insufficient performance of the original server, the need to switch to a Hong Kong or Japanese cloud server, or simply a desire to upgrade configuration. Regardless of the reason, DNS resolution is almost always the most critical step when changing servers. Improper DNS configuration can lead to unstable access, or even cause the website to be inaccessible for extended periods, significantly impacting SEO and user experience.

  Many beginners, when migrating a website, often only focus on ensuring the programs and databases are copied completely, neglecting proper DNS resolution planning. Only when actually switching domains do they discover that some regions are already accessing the new server, while others are still accessing the old server, and even search engine crawling is chaotic. These problems are not caused by the quality of the cloud server, but by a improper DNS switching process.

  To understand how to correctly configure DNS during website migration, it's essential to first understand the basic working principle of DNS. Simply put, DNS is a system that translates domain names into IP addresses. When a user accesses your domain, the local ISP's DNS returns the corresponding server IP address based on the resolution records. This result will be cached for a period of time, and this cache period is called TTL (Time To Live).

  Because of the TTL, DNS switching is not an instantaneous global synchronization, but a gradual process. This is why, at the same time, some people can access the new site, while others are still on the old server.

  Therefore, the core idea of ​​DNS configuration during website migration can be summarized in one sentence: prepare in advance, switch smoothly, and have a fallback plan.

  Before the actual migration, the first step is recommended to lower the TTL of the current domain name's DNS records 24 to 48 hours in advance. Many DNS panels have default TTLs of 600 seconds, 1800 seconds, or even 86400 seconds. If you switch IPs directly under these conditions, the cache will last for a long time.

  You can find the A record in the domain control panel and change the TTL to 300 or 120. Save the changes and wait for the original TTL to take effect. The purpose of this is to allow subsequent IP changes to propagate more quickly.

  After adjusting the TTL, don't rush to change the DNS. Instead, complete the server-side preparations first. This includes deploying the complete website environment on the new cloud server, uploading program files, importing the database, and testing access via IP or hosts file. You can temporarily bind the new server IP followed by your domain name in your local computer's hosts file.

  This way, only you can see the new site, while external users will still access the old server. This step is crucial; it allows you to detect program errors, path problems, or permission anomalies early, avoiding issues that only surface after the DNS switch.

  Once you've confirmed the new server is running correctly, you can officially modify the DNS resolution. This usually involves changing the original A record IP from the old server to the new server. If you're using a CDN, you also need to simultaneously modify the origin address to the new server IP; otherwise, even though users are using the CDN, the origin server will still point to the old server.

  After making the changes, save the DNS records. The DNS will then gradually take effect, with update times varying by region.

  The most common mistake at this stage is immediately shutting down the old server. The correct approach is to keep the old server running for at least 24 to 72 hours to ensure it can still handle access requests with unrefreshed caches. Otherwise, users still pointing to the old IP will experience direct access failures.

  To avoid data inconsistencies, it's recommended to set the old site to read-only mode before the official switch, such as pausing comments, disabling registration, or displaying a brief maintenance message. This prevents new data from being generated during the switch, causing inconsistencies between the two servers.

  If your website uses HTTPS, you also need to deploy an SSL certificate on the new server beforehand. Otherwise, after the DNS switch, browsers will report certificate errors, affecting user experience and search engine crawling. After certificate deployment, you can directly test whether Nginx or Apache loads the certificate correctly using the new server IP.

  For several hours after the migration is complete, it's recommended to continuously monitor access logs and server load. Pay close attention to whether there are still a large number of requests hitting the old server. If so, it indicates that DNS in some regions has not yet refreshed. This is normal; as long as the old server is still online, it will not affect users.

  Only after confirming that the old server has almost no new access should you consider officially shutting it down.

  If you're concerned about the risks of DNS switching, you can use a "dual-machine parallel" approach. This involves keeping both the old and new servers online simultaneously for a period of time and gradually migrating traffic through load balancing or CDN. This method is safer but slightly more expensive.

  In addition, there are a few easily overlooked details. First, ensure the new server's firewall has allowed ports 80 and 443; otherwise, even if the DNS takes effect, access will be impossible. Second, if you're using email services or subdomains, avoid accidentally deleting MX, TXT, CNAME, etc., records during the migration. Third, some website owners forget to synchronize wildcard DNS or API subdomains, leading to backend interface anomalies.

  Based on experience, a standard website DNS migration process should be: reduce TTL in advance → set up the new server → test hosts locally → modify A records → retain the old server → observe traffic → officially take the old machine offline. Following this order will almost never cause large-scale access problems.

  In summary, website migration itself isn't scary; the real problem often lies in the DNS switching process. DNS itself isn't complex, but it involves caching mechanisms and global node synchronization, which can become chaotic without prior planning. Once you understand the role of TTL and learn the three core principles of testing before switching and having a fallback plan, you can achieve a smooth transition even when migrating a website for the first time.

DNS Amy
DNS Becky
DNS Luna
Title
Email Address
Type
Information
Code
Submit