How to move a WordPress site from one host to another keeping same domain name
Recently, I had to undertake the very intimidating task of moving all of our WordPress websites from our old hosting company to the new one. The first time I attempted this a few months ago I lost a site in the massive abyss also known as the internet. I had searched all over the internet for a comprehensive list of the steps required to move a site successfully. After combining steps from a few different articles and troubleshooting on my own (with the assistance of my hosting company) I came up with a comprehensive checklist of my own. Here is the short and long version. I use the short version now that I’ve done this about 7 times, but for those that need more detail, I’ve got one for you too.
- Purchase hosting
- Backup copy of WordPress database and WordPress content
- Create new database, database user, database password, connect, and set user privileges/permissions
- Upload backup WordPress content and Import backup of WordPress database
- Change wp-config.php file to new database information previously created in Step 3 (Database Host is most likely “localhost” but check with your hosting company)
- In cPanel, change PHP Configuration to “PHP 5” – this is the version WordPress uses
- Redirect DNS to new name servers (check with new hosting company for what their name servers are)
- Purchase hosting for your site’s domain name
- Make Backup Copies of Site
- WordPress database
- If you have access to phpMyAdmin for your old host then export your database in SQL format
- If you don’t have access, ask whoever manages your website to send you a copy of the database as a .sql file
- WordPress content
- From the WordPress Admin Panel, click “Tools” -> “Export” -> “All content” -> then “Download Export File.”
- In the cPanel of your new host, create a new database, database user, and database password. Connect the database user to the database name and grant the database user all permissions/privileges. If your cPanel offers a MySQL wizard, I would recommend using this because it walks you through each of these steps so you won’t forget to do one. The first time I created the new database I didn’t use the wizard and I forgot to set the permissions. It caused a minor problem later on that was fixable but required some time to troubleshoot. So save yourself some time and use the wizard.
- Upload Backups (made in Step 2)
- WordPress Database: In phpMyAdmin, click the database you just created, then click “Import” on top option menu. Find and select your .sql file and click “Go.”
- WordPress content: In the file manager, upload backup .xml file to “public_html” directory. This will upload a zip file to this directory. Unzip the file and copy the contents of that file back to the “public_html” directory so the path is direct.
- Update the wp-config.php file with the new Database Name, Database User, and Database Password; Database Host will most likely remain “localhost.” Save.
- In cPanel, click “PHP Configuration” and select “PHP 5” from the drop down menu and click “Update.” (PHP 5 is the version WordPress uses)
- From your domain name registrar, redirect the domain name server (DNS) to point to your new hosts’ name servers. Contact your host to find out what these are.