Performancing Metrics

How To Transfer A WordPress Site To A New Host Securely & Without Downtime

As a follow up to my article last week on some useful WordPress 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.

WordPress 4

Hopefully, your reason for moving your website is 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 your your 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 that provides powerful end-to-end encryption, deep monitoring and auditing features and everything you will need as you move your online business beyond a simple WordPress site and start offering a vast portfolio of services. Services that rely heavily on network availability for your clients. You need to be ready to scale.

Here’s 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 host’s 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:

wp-directory

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 the image 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.

Task 2 – Optimize Your Database

You will be creating a backup of your WordPress database but before you do, you it’s good to optimize 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.

Task 3 – 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.

Task 4 – 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.

backup-database

To backup your database within phpMyadmin:

Once you’ve 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.

wp-backup

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.

Task 5 – 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.

Task 6 – 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 host’s tech support to increase it.

Task 8 – Edit the wp-config.php File

wp-config

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 can’t 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.

That’s 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.

Categories: WordPress Tutorials
Tags: ,

This post was written by . You can visit the for a short bio, more posts, and other information about the author.


Comment with Your Facebook Account

Comments

  1. Tahir Khawaja ) says: 7/29/2014

    Any directory paths that have been saved in the database will need to be verified and corrected. This may involve editing of serialized data. This is an important and complicated step, which is missing from the tutorial.

    Reply

  2. phan nhuom toc says: 7/30/2014

    Nice This is amazing .
    I love the way you write,I really like this.
    These are excellent tips. this stuff is amazing.
    Thank for sharing this awesome post. This will help me so much.

    Reply

  3. Lennart Heleander says: 7/30/2014

    I first transfer all the files and database, use a test url to see if the database is working fine and then I change the nameservers of the domain.

    Reply

  4. Scott Chow says: 7/30/2014

    It’s easier if you skip over optimizing the database and/or disabling the plugins, and MOST of the time it will work out fine. But it’s worth the few extra minutes those steps take, because when things go wrong, man is it frustrating!

    Reply

  5. Angela Bowman says: 8/1/2014

    It’s a good idea to edit your local hosts file before pointing DNS or A Record to check everything first.

    But, otherwise, a very great article! Keeps me from having to write it. :-)

    Reply

  6. Angela Bowman says: 8/1/2014

    Also, Tahir’s point is good as some plugins, like Shopp, have a field for the server file path which you will need to reset. That’s pretty infrequent, and Scott is right on. However, a bloated DB can cause issues on import. Also, disable caching plugins and delete cache. I’ve had lots of snafus in migration if caching was left on. Completely delete the cache, disable caching, then deactivate the caching plugin (for good measure). I’ve had to go as far as deleting the caching settings in the htaccess and WP-config file.

    Reply