To migrate a website with zero downtime, the secret is to fully set up the new server before changing your DNS. By the time the domain points to the new host, the site is already running there and visitors never notice a thing.
This guide walks you through every step from copying files to final confirmation, with no last-minute scrambling.
Before You Start: What You Need to Prepare
A smooth migration requires you to have at hand:
- FTP/SFTP or cPanel access on your current hosting.
- cPanel/Plesk or SSH access on your new hosting.
- Access to your domain registrar's panel (GoDaddy, Namecheap, etc.).
- An FTP client like FileZilla (or the cPanel file manager).
- Estimated time: 2–4 hours of work + 24–48 hours for DNS propagation.
If your site uses a database (WordPress, Joomla, PrestaShop, etc.), the process includes exporting and importing that database in addition to the files.
Step 1 — Copy All Files to the New Server
Connect to your current hosting via FTP and download everything from the public_html folder (or your site's root folder). For sites with many files or images, use the cPanel compression feature:
- In the current cPanel go to File Manager.
- Select the entire
public_htmlfolder and compress to ZIP. - Download the ZIP to your computer.
- Upload the ZIP to the new cPanel and extract it in the same location (
public_html).
This method is much faster than transferring files one by one via FTP when you have thousands of files.
Step 2 — Export and Import the Database
If your site uses a database (MySQL/MariaDB), this step is critical. An error here can leave the site without content.
Export from the current host
- Access phpMyAdmin from your current cPanel.
- Select your site's database.
- Click Export → Quick method → SQL format → Go.
- Save the
.sqlfile to your computer.
Import to the new host
- In the new cPanel, create a database and a user with a password under MySQL Databases.
- Assign all privileges to the user on that database.
- Access phpMyAdmin on the new host, select the empty database, and use Import to upload the
.sqlfile.
Update credentials in the config file
For WordPress, edit the wp-config.php file on the new server with the database name, user, and password you just created:
define('DB_NAME', 'new_database');
define('DB_USER', 'new_user');
define('DB_PASSWORD', 'new_password');
define('DB_HOST', 'localhost');
For other CMS platforms (Joomla, PrestaShop), the equivalent file is configuration.php or config.inc.php.
Step 3 — Test the Site on the New Server BEFORE Changing DNS
This step is what makes the migration truly zero-downtime. The trick: modify your computer's hosts file so your browser resolves the domain to the new host's IP address, without anyone else seeing the change.
How to edit the hosts file
| Operating system | File path |
|---|---|
| Windows | C:\Windows\System32\drivers\etc\hosts |
| macOS / Linux | /etc/hosts |
Add a line with the new host's IP and your domain:
123.45.67.89 yourdomain.com www.yourdomain.com
Save the file (requires admin permissions). From that point on, only on your computer will the domain point to the new server. Browse your site and verify everything works: pages, images, forms, store, member area.
When testing is complete, remove those lines from your hosts file.
Step 4 — Change Your DNS and Wait for Propagation
With the new server tested and working, it's time to redirect live traffic. Go to your domain registrar's panel and update the nameservers (or A records) to those of the new host.
- If you change nameservers (NS): propagation takes 24–48 hours to complete globally.
- If you only change the A record (the IP): you can reduce the TTL to 300 seconds a few days before the migration to speed propagation down to 5–10 minutes.
During the propagation window, some users will still see the old hosting and others will already see the new one. Keep the old hosting active until you confirm propagation is complete (use whatsmydns.net to check from different locations).
For a professional migration with expert backup, the team at elenlace.com can handle the entire process and guarantee zero service interruption.
Step 5 — Confirm and Cancel the Old Hosting
Once propagation is complete and the site works perfectly on the new server:
- Make one final backup of the old hosting just in case.
- Verify that email (if you use the hosting for email) also works on the new server.
- Cancel your plan on the old hosting — many providers have cancellation windows, so act before the next renewal date.
Find more guides on web performance and migration in our performance section.
Key Takeaways
- The key to zero downtime is having the new server fully configured and tested before changing DNS.
- Edit your local
hostsfile to test the site on the new server without anyone else seeing it. - Export the database after copying the files and just before the DNS change to capture the most recent data.
- Reduce the A record TTL to 300 s a few days in advance if you want faster propagation.
- Keep the old hosting active for at least 48 hours after the DNS change.
Running an e-commerce site or high-traffic web application? Contact us — we design custom migration strategies that guarantee service continuity even in the most complex scenarios.
FAQ
How long does DNS propagation take?
In practice, between 1 and 48 hours depending on the configured TTL and intermediate DNS resolvers. If you reduced the TTL to 300 s in advance, most visitors will see the change in under 10 minutes. If you left the TTL at 3600 s or more, expect a 24–48 hour gradual transition.
What happens if my site receives orders or registrations during the migration?
If two versions are active during propagation (old and new hosting), orders or sign-ups will go to whichever server each user resolves at that moment. For critical stores or applications, the best practice is to migrate during low-traffic hours (overnight) and briefly put the site in maintenance mode only during the final database export.
Do I need to change anything in WordPress after migrating?
Besides updating wp-config.php with the new database credentials, check the WordPress options in the wp_options table: the siteurl and home rows must have the correct URL. If you also changed the domain (not just the host), use the Better Search Replace plugin to update all URLs in the database.
Do I need to migrate my email as well?
Only if you use email accounts from the current hosting. If you use Google Workspace, Zoho Mail, or another external email provider, your domain's MX records don't change and email is unaffected. If you use hosting-based email, create the accounts on the new server and configure your email client before changing DNS.
Further reading
Other providers and guides worth comparing: