How To Move WordPress To A New Server Or Host 2017/18

This could be considered to be shooting one’s self in the foot, as we’ve gained hundreds of clients over the years because there wasn’t clear instructions in a step by step format to move WordPress from one server,  to another properly without the usage of backup plugins.    Although backup plugins may suit some people to me they are a complete nightmare,  businesses rely on these plugins without checking the backups on a regular basis, only to find out that the backups are corrupt or never actually worked in the first place.   Following the instructions in this “how to” will teach you how to save your site and database to your computer ( for safe keeping  ) and reupload the files and database to your new host.

So, lets get started.  FTP!

I always recommend using an FTP client over a host provided web based file editor.  There are some great FTP programs out there that allow you to upload and download files to your server/host.  One of my favourites is Filezilla which can be downloaded here : https://filezilla-project.org/download.php

Once you have opened your FTP client,  entered your server/host details and have found your WordPress install, it should look similar to this :

filezilla FTP wordpress directory listing

Everything in the above folder ( the main WordPress root folder that contains folders such as wp-admin, wp-content ) you need to download to your computer,  often easy to create an empty folder on your computer and put all the files into that folder,    you should also have your new server/host setup and the new FTP open ready to use.   You may now upload all of the files you just downloaded to your new host.

Now all the files are download and uploaded,  its time to get your database from the old host/server. We like to do this manually again rather than using any plugin.

Downloading your database from phpmyadmin

(We use cpanel with the images captured below,  but if your host uses something different you may need to locate things slightly differently to the images outlined )

Login to your hosts cpanel account,  normally accessed via browsing to your domain such as ( yourdomain.com/cpanel )

Cpanel phpmyadmin block

You next click phpMyAdmin, you will then be presented with a column on the much like below,  you need to click on the database which your wordpress install is using,  for us this is rivmedia_2017.

Select your database

Once clicked you should see the expanded database tables,  this contains all of your wordpress data,  from core to plugins.

Now in the right hand window you will see some navigational items,  one of those is “export”

export your database

Once one the export page,  press “Custom – display all possible options”

Custom - display all possible options

Then make sure all tables are ticked for export :

Select all database tables

Now scroll down the page slightly and find the “compression” tab,  if you have a large database its a good idea to use the compression because your new host may have a limit on SQL uploading.

Gzip your database

Now your ready to export your database,  press the “go” button at the bottom,  depending on your server / host it may take a moment to process,  you will then be prompted to “save” the file to your computer.

save the database to your computer

Congratulations!

You now have all the data you need from your old host/server.   You can save all the files you downloaded from FTP and the database you just downloaded for long term storage as a backup if you need to ( its always good to keep historical backups ).   Now lets move on to uploading to your new server.

Login to your new server/host’s control panel. The first step is to create a new database that will be used for your new WordPress Blog.

Click on “MySQL Databases”.

MySQL Databases

Under “Create New Database”, enter a name for your new WordPress database, then click the “Create Database” button.

Name your new database

Once the database has been created ( should take seconds ),  we need to add a user to that database with the correct permissions.  This is normally on the same screen, but further down.

Enter a name and password for the WordPress database user and click the “Create User” button.

Add SQL users

Now you have to give the user you have just created permission to use your WordPress database. So on the same screen again, you will have the options given in the screenshot below. Select your user that you’ve just created,  and the database and click add.  Take a note of the database name,  user ( including the prefix ) and password as you will need these later.

Add user to database

On the next screen, you have the option to grant which permissions this user has to your blog’s database. Be sure to grant this user total access to the WordPress database by checking “All Privileges”, then click the “Make Changes” button.

Add user database permissions

 

Now its time to go and locate the compressed database you downloaded from the old server,  because we are going to import it to the new database and user that we’ve just created.

So back to the main cPanel screen click on “phpMyAdmin”.

Cpanel phpmyadmin block

In the drop-down box in the left column, select your new WordPress database that you’ve just created. It should say that there are no tables in the database yet, since it’s a blank database that you’ve just created.

Select your database

Click the “Import” tab in the navigation. Below you will see a  “Browse” button and select the .sql or .sql.gz file that you downloaded from your old WordPress database, then click the “Go” button.

importing your old database

This part can take some time depending on the size of your database, after waiting for the WordPress database to import, you should get a green notice saying that your database import has competed.

Successful Database import yay

Using a different domain than the original ?

If you have moved domains as well as hosts,  then there are some additional changes you need to make otherwise you will continuously get redirect loops when trying to access the site. We need to modify a couple of values. Still in phpmyadmin,  and still looking at your database tables.  You now need to find the “options table” ( wp_options )

wp options table

 

After you click the wp_options table you will find yourself landed on the “browse” tab,  scrolling down you will see an option for “siteurl” under the “options_name” column.  You will see your old WordPress URL in that field. If your new WordPress blog is on a new domain name, you need to edit that value to your new domain name,  If the domain name is the same then you can skip these sections until the final point.

You can do so by clicking the “Edit” button, which looks like a pencil.

Change your site URL

Once you click the “Edit” button, just enter your new WordPress domain and then click the “Go” button to save the changes.

Change URL

You now need to repeat that same process for a different field,  so head back to the “browse” tab,   now look for the field “home” instead of “siteurl”,  this is sometimes located on page two of the options,  You can change the page numbers at the bottom of the options table list.  Repeat the same process above,  changing your URL to the new domain. Click Go.

Database work complete – Final Point

 

Now the last thing todo is to edit your wp-config.php file which you previously uploaded to the new host. This is in the root folder of your WordPress blog (usually /home/ or /public_html/). You can do this with your FTP client you’ve used previously.

Find the file “wp-config.php” , open the file in a plain text editor or something like Dreamweaver,  notepad++ or similar.

Edit the wp-config

Once the the wp-config.php is open you will see something a little like the image below.  Half way through I asked you to take a note of the database credentials that you created for the new database/user,  you now need to use those details to make the connection from the files, to the database.

DB_NAME, DB_USER, and DB_PASSWORD.

Make sure you keep your details inbetween the ‘ ‘  brackets.

This IS NOT your WordPress admin username and password! This is your database’s name and password which you just created for your new host/server.

Wordpress database credentials

Save your changes,  Reupload the wp-config.php to your new server overwriting the one that is currently uploaded.

Thats it !

Congratulations, you’ve just learnt how to manually back up a WordPress site,  download it to your local computer and reupload and install it to a new server or host.  If you found any of this tutorial useful, please like, share and tweet it so it helps others too.

Now head over to your domain and login to the admin panel,  we’ve customised our WordPress login below, but you should know what the WordPress login looks like by now 🙂  (i.e. example.com/wp-admin).  Your admin logins will be the same as they we’re previously on your old WordPress blog.

Rivmedia wordpress login

If you are still struggling with anything mentioned here,  or any other WordPress related problem,  feel free to get in touch about our WordPress services