You can easily pay hundreds of $£ to migrate your WordPress website from one hosting provider to another but here is a free solution.
This guide is also a solution for anyone that has a failed automated migration or a hosting provider that is incompatible with the automated methods or do not allow wordpress site-to-site migrations due to restrictions.
It is also a checklist for solving common migration problems that result in a failed migration.
How to manually migrate your WordPress Server with easy to follow steps:
Important: Make sure you have access to both web server Control Panels (plesk/cpanel) along with FTP login details,
Domain DNS control panel settings, the IP of old and new servers and of course the WordPress login.
Step 1: Disable or remove security and caching plugins on the old/originating server.
Things like Wordfence, Login Lockdown, Securi, Jetpack or other Security plugins and also any Accelerator or Caching or Speed Up plugins.
If you have any proxy based services via things like Cloudflare then also disable this for now. You will need to set this up as new once its transferred.
It might be worth also checking for any Host provided plugins that may no longer be needed.
Make note of the PHP version the old server is running as the new server may need to match this in order to load correctly.
Step 2: Make sure your new/destination server is ready to go and working. The easy way to do this is to choose to auto install a standard default WordPress install from the control panel (cpanel or plesk) of the server. This will make sure the database is created and the server is working. Essentially you will over write this shortly. If you don’t have this auto install function then you will need to do this manually.
Step 3: Install ‘WP Migrate Lite’ by ‘WP Engine’ its free and available in the the Plugin installer of your WordPress dashboard. Install and Activate it.
Step 4: We need to make sure we have the directory path of the new server at this point. The true path can be very different when changing to a new server. The quickest way to establish this is with a simple PHP script. So simply copy the following code into a file called ‘findmypath.php’ on your new/destination server and get the results by visiting the page directly. EG: https://www.mydomainexample.com/findmypath.php
If for any reason it won’t show the result, try putting the script in a sub folder first.
You should get a results like: /var/www or maybe /var/www/vhosts/mywebsite.com/httpdocs
<?php
echo $_SERVER['DOCUMENT_ROOT'];
?>
Step 4: You can optionally put your old/originating site into ‘Maintenance Mode’ at this point but this is probably only needed if your site handles active purchases or bookings.
Step 5: Use the ‘WP Migrate Lite’ from the WordPress Dashboard, Left side under Tools Menu – WP Migrate: Then MIGRATE button at the top.
Now choose square with ‘Export’ written in it and make sure the first entry called ‘Database’ is ticked.
Then under ‘Standard Find & Replace’ look for the entry that is the path. There should only be two and the other is the domain name which we will leave blank for this purpose.
In the replace section on the right – paste your path that you found on the new/destination server that looks like ‘/var/www/vhosts/mywebsite.com/httpdocs’ or similar of course leave out the inverted commas.
Now choose the blue EXPORT button at the bottom and download the exported compressed database file.
Step 6: In the root of the WordPress folder make an extra copy of the ‘wp-config.php’ and ‘.htaccess’ into a completely separate location.
Do this for BOTH the old/originating and the new/destination! Don’t skip this as it will save time later.
Maybe create a folder on your PC to store the old and the new files so they are not confused later on.
Step 7: Copy all files from the old server to your local PC or if your control panel supports direct transfer, then use this server to server migration tool with usually requires the other servers FTP, SSH or SFTP credentials.
You will need all the files inside the master folder usually called ‘html’ or ‘httpdocs’ or simply the root of the servers ftp. Don’t copy statistics, backup, temp or log directories if they are in the root.
You can use Filezilla for this for the fastest possible transfers.
If you chose to download to your PC – you will need to now upload them all to the new server choose to overwrite existing files.
Step 8: Now import the database export you did earlier by going into your new/destination hosting control panel and choose to ‘Import Dump’.
There should be an option that says ‘recreate database’ from this new file and you want to tick that so that the database is clean.
Step 9: We now need to modify the new/destination ‘wp-config.php’ file so that it will work.
Open both the old and the new one side by side.
You need to essentially use most of the old file but copy the 4 sections as shown below into the old file and then save it.
Once saved – copy it to the new server.
/** The name of the database for WordPress */
define( 'DB_NAME', 'wp_abcdexample' );
/** Database username */
define( 'DB_USER', 'wp_example' );
/** Database password */
define( 'DB_PASSWORD', 'topsecretpasswordexample' );
/** Database hostname */
define( 'DB_HOST', 'localhost:3306' );
Step 10: Now we need to change the DNS ‘A’ record from the old server to the new server via your Domain Name provider or Control Panel.
Simply edit the A record and change the IP from old to new.
Step 11: Generate a SSL certificate on the new server after about 20 to 60 min after making the DNS change.
Step 12: Make sure your PC is finding the new IP by going to CMD/DOS and typing in:
nslookup mydomain.com
Result should look something like this:
Server: google.com
Address: 8.8.8.8
Non-authoritative answer:
Name: mydomain.com
Address: 123.123.123.123
If the IP is still the old IP – then either wait a bit longer or try typing ‘ipconfig /flushdns’ into the CMD/DOS box or manually editing your local PC host file for a temporary fix.
Step 13: Test all aspects of your website. If you run into issues. Check the web servers log file via Control Panel. Then maybe look at turning on any debug options. Just work through any issues one at a time. Also check PHP versions of old vs new hosts. Try turning off possible problematic plugins. If you have directory path issues – use that old .htaccess file and compare the old and new.
Its slightly tricky but these steps should help you most of the way.