Moving a WordPress Site to a New Server

There are lots of different web hosts out there and sometimes it can pay to move your site from one host to another in order to get both the best price and the best service. If you have a WordPress site and you are worried about moving the site to a new server then don’t, the process is straight forward and here is how to do it.

Lets think a little about how your website points to the current server. Usually the domain registrar is the service which controls the DNS for your domain name. This means it controls where your website is stored i.e. which server it is on. Something there could be some different name servers set by the registrar but you will need to change these anyway.

The first stage is to copy all of the data from your WordPress site. Your consists of 2 elements that need to be copied.  The first are the files. This is the WordPress files that make your website run in WordPress including  your theme, plugins and all your uploads. Therefore what I always do is run a backup of all the files on the server. If you are using a cPanel host this is very easy.  Click on the backups icon on the cPanel home screen and then click the button which says home folder.  This will download all the files to your computer that are on your website.  Once download unpack the compressed folder and you are interested in the public_html/ folder as that is where all your website files are stored.

What I now do is compress all these files into a ZIP file as it makes the site easier to upload to your new host.  Select all the files in the public_html folder and then compress them into 1 ZIP file.  Then login to the cPanel on the new host and upload this ZIP file to the public_html/ folder. Use the cPanel File Manager tools in order to extract the files to the same folder they were uploaded too.

Now for your database which is the second thing that makes your WordPress website work.  In the cPanel of your old host, click on the phpMyAdmin icon.  Once loaded select the database that is being used for your site from the list on the left. Now click the export button.  Make sure all the tables are selected as well as the Save As check box at the bottom and click go.  A .sql file will now be downloaded to your computer.

Next step is to create a new database with your new host and import the tables that you have just exported.  In the cPanel of your new hosts in the databases section, click on the MySQL Databases icon and then create a new database and user.  Add the user to the database and grant all privileges.  Now go in phpMyAdmin in the new host and select the database you have just created on the left.  Click on the import tab along the top.  Choose the .sql file that was downloaded from the old host and then upload this.  Once done you should get a message saying that a certain amount of queries were executed, thats fine.

There are now just a couple of steps left to take.  The first is that you will need to edit your wp-config.php file in order to reflect the new database and user details.  Use the cPanel file manager to load that file and make the changes for your new database name and user as well as the password that you set when you created the new database and user.  Don’t forget to save the file.

Last but not least you will need to point the domain at the new host. This can either be done my changing the name servers to the new name servers given by your host or adding A records with your domain registrar to point to the new IP address of your server.  Once you have done this is could take 48 hours for the DNS to propagate around the Internet and therefore I would leave both your old and new sites live, and don’t make any changes to them during this time.  After a couple of days you can remove your old server and everything should be fine.

Published by

Mark Wilkinson

Lead developer & owner at Highrise Digital @highrisedigital. Develops the @wpbroadbean plugins. Former teacher.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s