WordPress is one of the most popular content management systems around and it’s used to power millions of websites all over the world. Migrating WordPress can be daunting for inexperienced users, but the process is quite easy as long as you complete all the steps in the correct order.
There are a few options available for migrating WordPress. First of all, you can download a plugin to export your entire website. This isn’t recommended because sometimes plugins can fail and may not function correctly. Furthermore, plugins sometimes don’t migrate all your settings and widgets which will then need to be manually corrected after migration.
Sometimes, web hosting providers have a service to migrate your website for you. If your new hosting provider offers this service for free, then let them do it for you.
If you want to do it yourself, then follow the easy steps in this article.
Step 1 – Backup Files
Before you do anything, you should back up all the WordPress files to your computer. It’s good practice to backup WordPress before making any changes and you’ll need to back up your files in order to migrate the website.
You’ll need an FTP program or a WordPress backup plugin to download all your files.
Option 1- Backup through a WordPress backup plugin
A WordPress backup plugin is highly recommended as it can automatically make backups of your WordPress site without you worrying about it.
It is important to use a high quality plugin. We highly recommend Backup Pro – WordPress Plugin. As it is very easy to use and reliable.
The usage of Backup Pro speaks for itself and good documentation is included to help you if you do hit a problem.
Option 2 – Backup through FTP
Filezilla is one of the most popular tools available and it’s free to download. If you are a Mac user we would recommend Transmit. After you have installed your preferred FTP program, login to your old hosting.
You can find your FTP login information in your cPanel. If you can’t locate this information, or it isn’t working correctly, you will need to contact your hosting provider.
Once you’ve successfully logged in, select all the files in your WordPress directory and copy them to your hard drive. The time it takes to download your entire website will depend on the size of the website and your connection speed.
Step 2 – Database Export
You’ll need to back up the database by exporting the SQL database from your old hosting and download it to your computer. If you are using Backup Pro, you will have a ready to use option to download your database and you can skip these instructions.
If you are not using Backup Pro , login to your cPanel and then find and open “phpMyAdmin”. On the left side of the window, you’ll see a list of all your databases. If you have more than one database, you’ll need to know which one is used for your WordPress website.
Default WordPress databases start with a prefix of “wp” followed by a 3-digit number. Sometimes, people choose various names for databases and it may not be in this format. To be 100% sure that you’ve got the right database, expand the database you think it might be and look for a table that contains the word “options”.
Open the options table by clicking on it and then you should see the “siteurl” and “home” rows. The value to the right of these rows will contain the URL for your WordPress installation.
If the database doesn’t contain the “options” table, or the “options” table doesn’t contain information regarding “siteurl” or “home”, then it isn’t a database used by WordPress.
Once you have located the correct database, click on the name and you should see all the tables listed on the right-hand side of the screen. At the top, click the “export” button and you’ll be given a choice of two methods. Choose “quick” and then ensure that the format is set to SQL and click the “Go” button. The database will then start to download.
Step 3 – Changing the Domain or Installation Folder
If you are changing your domain name or the installation subfolder at the same time as changing your hosting, you’ll need to update WordPress before you upload the files and database to your new hosting. If you are not changing the domain name and are only migrating the website to a new server, you can skip this step and move directly to step 4.
Go to settings and then select general settings. Update the “WordPress Address (URL)” and “Site Address (URL)” with your new domain or subfolder.
After you have done this, you will be logged out of WordPress and you won’t be able to log back in as the website will try to redirect to your new domain or subfolder. Ensure that you enter the correct details because if you made a mistake, you will need to manually edit the database.
Download all the files and export the database again, as explained in steps 2 and 3. Keep it in a different directory from your original backup because if there is a problem, you can restore your original website with the first backup.
Step 4 – Create a New Database
Go to the cPanel for your new hosting and select “MySQL Databases”. Here you’ll see a screen which allows you to create a new database. Type in the name of your new database and click “Create Database”. Make a note of the database name.
Scroll down the page and add a new user. Enter a username and password and click “Create User”. Again, make a note of the username and password.
Finally, you’ll need to add the user to the database. Towards the bottom of the screen, you’ll see where it says “Add User to Database”. In the two dropdown menus select the user and the database that you’ve just created and click “Add”.
A new screen called “Manage User Privileges” will appear. Click “All Privileges” and then click “Make Changes” at the bottom of the screen.
Step 5 – Connecting to the New Database
Go to the directory where you saved your WordPress files and locate the wp-config.php file. First, make a copy of the file so if you encounter any problems, you can easily restore the original wp-config.php file.
Open wp-config.php in a text editor like notepad and make three changes.
Locate the lines which read:
The ‘name’, ‘user’ and ‘pass’ sections will contain the information required for your old database. Enter the new database name, username and password. Save the file and exit your text editor.
Step 6 – Upload Files
Now that your files and database have been downloaded and you’ve successfully updated wp-config.php with your new database information, you’ll need to upload the files to your new hosting.
Use your FTP program to connect to your new hosting and upload your files into the correct directory.
If your WordPress website is your main domain, you can upload the files directly to your “public_html” folder. If the website is an addon domain, you will need to locate the correct folder and upload the files to that folder.
Step 7 – Import Database
Log in to cPanel on your new hosting and go to phpMyAdmin. Here you will see the database that you’ve recently created. Click on the database which you created in step 4 and then click on the “import” button on the top menu.
Click “Browse” and locate the database that you exported from your old hosting. Uncheck the “Partial Import” checkbox and ensure that the format is set to SQL. Click “Go” and the old database will start to be imported.
The length of time it will take to import your database will depend on the size of the database and your connection speed.
Step 8 – Update Custom Links
If you have changed the domain name or installation directory as well as your hosting, you will need to find and update any custom links that you have inserted. In most cases, these links will be in your menus and widget areas.
If the domain name and installation directory remain the same, you can skip this step and proceed directly to step 9.
If you are having problems finding all your custom links, you can use software such as Xenu’s Link Sleuth to find all internal links that produce 404 errors. Use this information to update all broken links.
If you are confident with updating the database directly, you can use phpMyAdmin to search and replace all instances of the old domain or installation directory and update them with the new information.
Step 9 – Update Nameservers
Now that your WordPress installation has successfully been uploaded to your new hosting, you’ll need to tell your domain where the server is located. Login to your domain registrar and look for an option to change nameservers. Each registrar is different and if you can’t locate where you can update the nameservers, you’ll need to contact customer support to help you.
Enter the new nameserver information for the domain. Now you’ll need to wait until the changes have been propagated around the internet. This can take up to 48 hours to complete. It’s important that you don’t make any changes during this time and just wait until the nameservers have been fully propagated before updating your website.
Many website owners will change hosting at some point during the life of their website. Sometimes websites outgrow their shared hosting and require a virtual private server or even a dedicated server. It may be that your hosting provider isn’t living up to your expectations and you want to find a better host.
Whatever reason for migrating WordPress hosting, it isn’t as difficult or as daunting as you might think. Make sure that you follow the steps in this article exactly as described above and you shouldn’t run into any issues.