All articles · Published 2026-06-22 · 471 words · 2 min read · EN · RU · ES

How to Migrate WordPress to a New Host with Zero Downtime

Achieving zero downtime during a WordPress migration requires a strategic cutover. If you change DNS records without preparation, some users will see a broken site due to DNS propagation delays. Follow this step-by-step technical guide to migrate your site seamlessly.

Step 1: Lower the DNS TTL

Time to Live (TTL) dictates how long DNS servers cache your domain's IP address. By default, this is often set to 86400 seconds (24 hours).

  • Log into your DNS provider (e.g., Cloudflare, Namecheap, Route 53).
  • Locate your domain's A Record.
  • Lower the TTL to 300 seconds (5 minutes).
  • Perform this step 24 to 48 hours before the migration to ensure the old TTL expires worldwide.

Step 2: Transfer WordPress Files

Compress your WordPress directory on the old server and transfer it to the new server using SSH for maximum speed and security.

# On the old server: Compress the public_html directory
tar -czf wp-migrate.tar.gz /var/www/html

# Transfer the archive to the new server
scp wp-migrate.tar.gz user@new-server-ip:/var/www/html

On the new server, extract the archive in your target directory:

# On the new server: Extract files
tar -xzf wp-migrate.tar.gz

Step 3: Export and Import the Database

To prevent data loss, export the database right after transferring files. If your site has highly dynamic content (like WooCommerce), temporarily pause comments or transactions during this export window.

# On the old server: Export database
mysqldump -u old_db_user -p old_db_name > db_export.sql

# Transfer the SQL file to the new server
scp db_export.sql user@new-server-ip:/tmp

Create a new database and user on the destination server, then import the SQL file:

# On the new server: Import database
mysql -u new_db_user -p new_db_name < /tmp/db_export.sql

Step 4: Update wp-config.php and Test Locally

Edit the wp-config.php file on the new server with your new database credentials (DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST).

Before changing DNS, test the new server locally by modifying your local machine's hosts file. This forces your browser to load the website from the new server's IP.

  • Windows: C:\Windows\System32\drivers\etc\hosts
  • macOS/Linux: /etc/hosts

Add the following line to the bottom of the file:

[NEW_SERVER_IP] yourdomain.com www.yourdomain.com

Save the file and load your site in an incognito window. Verify that all pages, plugins, and images load correctly on the new host.

Step 5: Point DNS to the New Host

Once verified, remove the line from your local hosts file. Then, update your domain's A Record at your DNS provider to point to the new server's IP address.

Because you reduced the TTL in Step 1, traffic will shift to the new host within 5 minutes. Keep the old hosting account active for at least 48 hours to serve any straggler traffic cached by slow ISP DNS servers.

Need this done? We handle this hands-on at GuardLabs — get in touch for a quote.

Need help with this?

I take on freelance fixes and builds in this area.