Migrating a live WordPress site sounds simple. Move the files, move the database, point the domain. Done.

In reality there are about fifteen ways for it to go wrong. If you do it badly your site goes down, emails stop working and your client is calling you in a panic. If you do it properly nobody notices anything changed except that the site is faster.

Here is the exact process we follow for every WordPress migration.

Before You Start: Do These Three Things First

Take a full backup. Everything. Database, all files, uploads, themes and plugins. Store it somewhere separate from both your old host and your new host.

Reduce your DNS TTL. Find your domain’s DNS settings and reduce the TTL to 300 seconds or five minutes. TTL controls how long DNS servers cache your records. Lowering it now means that when you change your DNS the update spreads much faster. Do this at least 24 hours before your migration.

Document your current setup. Note your current PHP version, any custom settings in your .htaccess file and any environment variables your site depends on. You need to replicate these on the new host.

Step 1: Set Up the New Host First

Get your new hosting environment completely ready before you touch anything on the old site.

Create a database, set up PHP at the right version and make sure the server environment matches what your site needs. Do not point your domain to the new host yet. Most managed hosting providers will give you a temporary URL to access your new server during the migration. Use that.

Step 2: Copy Your Files

Transfer all your WordPress files from the old host to the new one. The most reliable method is SFTP. Connect to your old host, download everything from your WordPress installation and upload it all to the new host.

For large sites SSH access and rsync is faster and more reliable than FTP for transferring large file sets.

If you prefer a plugin approach, All-in-One WP Migration or Duplicator handles the file transfer for you. Just check that the free plan supports your site’s file size before relying on it.

Step 3: Export and Import Your Database

Export your database from the old host. In cPanel use phpMyAdmin and export the full database as a SQL file. If you have SSH access use wp-cli, which is faster and more reliable.

wp db export backup.sql

Create a new database on your new host and import the SQL file into it. Update your wp-config.php on the new host to point to the new database with the correct credentials.

Step 4: Run Search and Replace

Your WordPress database contains your old domain URL stored in many different places. Before anything will work properly on the new site you need to replace the old URL with the new one throughout the entire database.

Use WP-CLI for this.

wp search-replace ‘https://oldsite.com’ ‘https://newsite.com’ –all-tables

If you do not have WP-CLI access the Better Search Replace plugin does the same thing through the WordPress admin. Do not try to do this manually in the database. WordPress stores some data in a serialised format that will break if you do a simple text replacement on it.

Step 5: Test Everything Before Touching DNS

Test your site thoroughly using the temporary URL on the new host. Check every page. Test contact forms. Make sure emails are sending. Check that images load properly. If you have WooCommerce test the full checkout flow.

Fix everything you find before you change any DNS settings. This is your chance to catch problems while your live site is still running on the old host.

Step 6: Switch Your DNS

Once you are satisfied everything is working, update your DNS records to point to the new host’s IP address.

Because you reduced your TTL earlier the change will propagate within five to ten minutes for most visitors.

Keep your old hosting account active for at least 48 hours after the DNS change. Some DNS servers may still be serving your old IP during that window.

Step 7: Check Everything After the Cutover

Once DNS has propagated verify that your live site is loading from the new host. Check your SSL certificate is working. Run a PageSpeed test. Monitor your server error logs for the first 24 hours.

The Mistakes People Make

Doing the search and replace before testing on the new host. Do it after, not before.

Not testing email sending before the cutover. SMTP settings often need updating on a new host.

Cancelling the old hosting account straight away. Give it 48 hours.

Rushing the DNS cutover without testing everything first. Take your time.

A migration done properly takes a few hours. A migration done in a rush takes those same hours plus however long it takes to undo what went wrong.

Need a WordPress site migrated to better hosting without the risk? CodingBrackets handles migrations as part of our performance and hosting work. Get in touch.