If you own or maintain a WordPress website, there is a very high probability that you have already considered looking for a new hosting company on more than one occasion. This is the reason we put together this tutorial for migrating a WordPress website.
Perhaps you are fed up with the slow performance of your website, failing database connections or less than adequate customer support.
Many hosting companies just fail to put up the necessary infrastructure that could tolerate host failures. They are forced to run at their peak capacity and cannot deal with a single host failure. This in turn is a blatant disregard of the best practices.
Before WordPress migration
Prior to migrating a site, you need to ask yourself a few questions:
– Are your present and future hosts running the same web server? – If both webhosting companies run an Apache server, you shouldn’t expect complications. If they do not, however, and you are migrating from an Apache to Nginx server, for example, you may need to make certain configurations to ensure your website runs smoothly on the next server.
– Are your current and destination hosts running different PHP versions? The difference between PHP 5.3.2 and PHP 5.2.3 could have a substantial impact on WordPress or on some of the plugins the CMS uses.
– Are both hosts running different MySQL versions? Ensure your new host runs MySQL 5.0 or a more recent version. Anything below 5.0 won’t cover the minimum requirements for a successful WordPress migration.
Moving the content
After you have successfully uploaded the wp-content directory, containing the static files of your site, to the new host, you can use the import/export feature found in the Tools menu of your WP dashboards to restore the site’s content.
This is a straightforward task that doesn’t require from you to directly interact with the site’s database.
This is great for a situation in which you already have a WordPress installation on your new host. Because you already have a new and functional WordPress site, you don’t have to overwrite the wp-config.php file in the main directory of your installation. Doing so will break the connection with the database.
This is the simplest method for exporting all types of data from a WordPress site, including pages and posts, comments, custom post types, categories, custom fields, custom taxonomies, tags, users and theme attributes. Be cautious, however, that this method is not the same as restoring a full database backup. While it is true that you may get all your content up and running on the new hosting, you could leave something behind.
Working with the database
As WordPress requires MySQL, it is assumed safe to claim that more than 99% of all WP websites use it, and all hosting companies will provide you with the number of MySQL database you require for a certain price.
phpMyAdmin is the tool which allows you to interact with a WordPress database. This application for managing MySQL databases makes it simple and easy to work with a database through a browser. Exporting the WordPress database with phpMyAdmin is a straightforward task, a part of the migration process, and the web provides countless tutorials on how to do it.
Modifying the wp-config.php file when necessary
After you transfer the static files of your site from your old to your new hosting via FTP, you have to ensure that the database connection is established properly.
If in doubt, examine, and when necessary, update the hostname, the database name, the user and the password credentials with those provided to you by your new host.
A word of warning: If you replace your existing wp-config.php file with the one from your old host, you will break the connection with your new database and render WordPress useless.
After the migration is successful, it would be great to delete the parts of your old WP installation you no longer require. Removing he static files you just transferred via FTP and deleting the database via phpMyAdmin should be sufficient.
A simplified WordPress migration
The way I migrate WordPress websites is by using plugins. The free version of WP Migrate DB will allow you to migrate websites from your old to your new hosting provider or, if you are a WordPress developer, migrate databases between your localhost environment and your live server. The plugin also has a premium version called WP Migrate DB Pro, which automates tasks by allowing you to pull and push databases back and forth, create migration profiles, choose which database tables to migrate and more.
But let me tell you a secret. There is a similar plugin that does just the same job as the premium version of WP Migrate DB and comes free. It is called WP Sync DB and you can download it from GitHub. Migrating WP databases with WP Sync DB is a breeze.
This tutorial for migrating a WP site presented you with two ways to migrate a website – manual and with the help of a plugin. Which is your preferred way to migrate a WordPress-based website? Let us know in the comments below!