Skip to Content

Migrate WordPress to a New Server Without Downtime

Planning makes the difference

Moving a WordPress site from one server to another should be simple. In theory, you copy files and database, switch DNS, and you're done. In practice, there are enough pitfalls to fill this article.

Preparation

Document current setup: PHP version, MySQL version, active plugins, .htaccess rules, cron jobs, SSL certificate. The new server needs to match or be compatible. Don't change PHP version at the same time as migrating; that's asking for trouble.

Copy files

rsync is best for large sites: rsync -avz --progress /var/www/html/ user@newserver:/var/www/html/. It only copies changed files on a second run. Alternative: pack with tar, transfer with scp, unpack.

Database

mysqldump -u user -p dbname > backup.sql on the old server. mysql -u user -p dbname < backup.sql on the new one. Check character encoding: if the old database is latin1 and the new is utf8mb4, special characters can break.

Search-replace

If the domain changes (or switching from http to https): wp search-replace 'https://old.com' 'https://new.com' --all-tables. Don't do it manually in SQL; WordPress serializes data that breaks with simple text replacement.

The DNS switch

Lower TTL to 300 seconds at least 24 hours before the move. Change the A record (or CNAME). Keep the old server running for 48 hours so visitors with cached DNS still reach the site.

Test everything on the new server via hosts file before switching DNS. Then you see exactly what visitors will see without affecting the live site.

WooCommerce Installation: Right from the Start
Avoid the most common beginner mistakes