Moving a website to a new host makes most site owners nervous, and with good reason. One wrong step can take down your store, lose orders or leave broken images all over the site.
I have moved a lot of WordPress sites over the years. This is the process I follow.
Why migration plugins often fail
Migration plugins are fine for a small blog. On a bigger site, especially a store with gigabytes of uploads and orders coming in, they often time out halfway through. You end up with a half-copied database and missing media, which is worse than not moving at all.
For anything important, I move the files and database myself.
My four-step process
1. Lower the DNS TTL a day early. In your DNS settings, set the TTL for your domain to 300 seconds at least 24 hours before the move. When you switch, visitors will pick up the new server within minutes instead of hours.
2. Copy everything from the old server. Export the full database (a mysqldump or a cPanel backup) and copy the entire site folder, including wp-content/uploads.
3. Set it up on the new server. Import the database, upload the files and update wp-config.php with the new database name, user and password.
4. Test before anyone else sees it. Edit the hosts file on your own computer so the domain points to the new server just for you. Then click through everything: the homepage, forms, checkout, logins and SSL. Only switch the public DNS when it all works.
Never change DNS until you have tested the new copy yourself. Test first, then switch.
The mistake that breaks most domain changes
If the domain name is changing too, don't just run a find-and-replace on the database file. WordPress stores many settings as serialized data, which records the exact length of each piece of text. Change the text without updating those lengths and widgets, theme settings and page builder layouts break.
Use WP-CLI instead:
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --all-tables
It updates serialized data correctly.
If you'd rather not do this yourself, I handle migrations for Alif Host customers and for clients directly. Get in touch and I'll move it for you.
