As a follow up to my article last week on someusefulWordPress plugins that make website migration simpler, I thought I’d give a quick overview on how to get it done safely. The route I’m about to describe is not necessarily the shortest route as some of those plugins did make it less technical. However, I’ve chosen to share more details about the process allowing more readers the opportunity to learn more about how WordPress and how it’s file and database works. Plugins and tools are great but having a deeper understanding and experience will set you apart and give you more knowledge with which to troubleshoot.

Hopefully, your reason for moving your websiteis due to a substantial rise in traffic and you require greater resources to handle it, and not because of an unreliable hosting provider. The availability of your website is crucial and there is no room for errors or downtime while building youryour online business, since this can translate to missed opportunities.

If you’ve been publishing online for some time now it’s very likely that it will be beneficial for you to make a host switch as cloud hosting technology continues to advance and become more affordable. Usually, basic hosting providers such as BlueHost and HostGator are sufficient but as your online business grows and require more resources, providers such as WP Engine and FortyCloud become more viable options. FortyCloud for example, is a security and software as a service platform thatprovides powerful end-to-end encryption, deepmonitoring and auditing features and everything you will need as you move your online business beyond a simple WordPress site and start offering a vast portfolioof services. Services that rely heavily on network availability for your clients. You need to be ready to scale.

Heres a simple tutorial to help you complete the web host transfer with absolutely zero downtime and without hiring a professional to take care of the task for you.

Task 1 – Backup All WordPress Files

Once you have your new hosting account ready and activated, you can start creating a copy of your existing files with your current web host. Login to your old web hosts control panel and navigate to your File Manager. The folder you will need to backup is the one that contains all WordPress content including images and core files. This is usually within the public_html folder and the WordPress root will usually look like below:

The simplest method for backing up these files is to select all files and folders within the directory and execute the compress command which will compress all files within the folder into one manageable zip file. The option usually looks like theimage below:

You can also use an FTP client like FileZilla to login to your FTP account and transfer the files directly to your computer. This requires that you have a valid FTP account setup with access privileges to the folder you’re trying to backup.

Task2 Optimize Your Database

You will be creating a backup of your WordPress database but before you do, you it’s good tooptimize your database tables. An easy way to do this is to use the optimize tables option with the WP-DB Manager plugin. This is necessary to reduce the size of your database backup.

Task3 Disable all Plugins

Login to your WordPress dashboard and disable all plugins. Although plugins are smarter these days, there’s still a possibility that errors may occur when fiddling with their files while active.

Task4 Backup your WordPress Database

There are 2 ways to do this – either via phpMyadmin, which is a tool provided by your hosting provider or using the WP-DBManager WordPress plugin, the simpler method.

To use phpMyadmin:

Login to your old hosting account and select your phpMyadmin or manage MySQL option to gain access to your databases. Create a backup of your WordPress database and download the SQL copy to your computer.

To backup your database within phpMyadmin:

Once youve completed the steps in the diagram scroll to the bottom of the screen and select Go. This will download the SQL file to your computer.

To backup with WP-DBManager:

Once logged into your original WP installation admin, hover over the “Database” menu item and select “Backup DB” and the options below with be shown. I blocked out some of the details for security reasons as revealing information about database names and paths publicly is a good way to get hacked.

Then select “Backup.” Once the backup is done, navigate to “Manage Backup DB” where you’ll be able to select and download your backup file.

Task5 Upload the Downloaded Zip File

Login to your new hosting account and upload the compressed file you downloaded in Step 1. This should be uploaded to your root directory. Once uploaded, go ahead and extract the files to the directory. You will then see that your WordPress folders and other content are now present.

Task6 Create The New Database

Within your new hosting account, you will need to create a new database. Most web hosting accounts provide a Database Setup Wizard that will take you through the steps for creation. Use this option and it will allow you to assign the database name, user, password and account privileges. Ensure the user is assigned all privileges and copy all these details to your notepad for use later.

Task 7 Restore Backup Database

Within your new host, select your phpMyadmin option and select the database you created in Step 6. After selecting the database, you will notice that it has no tables. Then you should select the Import tab to import the old tables into the new database.

Click Browse to search for the database backup file you downloaded in Step 4, then select Go. This will begin the upload process which can take a while depending on the size of your database backup file.

Take note of the maximum file upload size on this screen as you will not be able to upload anything larger. If it is larger then you would need to contact your new hosts tech support to increase it.

Task 8 Edit the wp-config.php File

Browse to the file manager of your new hosting account and search for the wp-config.php file within the root directory. This is where you will enter your new database details. As shown above, edit this file with the new database credentials and save.

Ensure that you download a backup copy of the wp-config.php so that you can revert to the backup in case you make any major mistakes.

Task 9 Assign The New Name Servers

Now that all files and database tables have been transferred to the new hosting account, it’s time to change the name servers so that they point to the new host provider. Usually, the name server is displayed along with general statistics and account details. However, if you cant find it then contact tech support.

The name server normally takes the format of ns234.hostprovider.com & ns235.hostprovider.com and sometimes up to 4 entries. you should only need 2.

Your host provider will tell you that it takes up to 72 hours for the new names to propagate but it usually takes about an hour or two. As long as you following the steps above accurately you will not even notice when the change is complete.

Conduct Thorough Testing

Ensure that once the transfer is complete you conduct a thorough testing of all plugins and features of your site and WordPress dashboard to spot any potential problems.

Thats it, you have successfully transferred your WordPress site to a new host.

Troubleshoot

If you receive the error message Error establishing a database connection after the transfer takes place then you will need to check to ensure that you entered your database credentials correctly in the wp-config.php file and that it is uploaded to the new host directory.

If you experience any difficulties or would like to contribute a better idea for making this process more efficient, feel free to leave us a comment below.