Moving a WordPress site to a new domain may seem daunting, but follow the steps below and you’ll be up and running in no time.

The instructions below will help you move a standard WordPress site to new hosting and configure the site to work correctly on the new domain.

This guide assumes the following:

  • The site is moving to a new server
  • The domain name is changing
  • Your new domain name is already pointing to the new server
  • You know how to access your hosting control panels
  • You have some basic knowledge of WordPress, Databases, Hosting and FTP Clients.

Step 1 – Backing up your site

The first step in moving your WordPress site is to make sure that you have a backup of all the site files locally on your computer. We will be using these file to upload to the new server, so we need to make sure that we have a confident copy of every file. To do this you will need to connect to your old server via ftp and download the entire WordPress installation.

Depending on your broadband connection and the size of the site this can be a lengthy process, so grab a cup of tea and put your feet up! Alternatively you can make a start on step 2.

Step 2 – Backing up your database

WordPress is a CMS system that stores important information and content in a MySQL database. This database is vital to the way your website looks and acts. We need to make a backup of the database that WordPress is running from to transfer it to the new database. The easiest way to do this is with phpMyAdmin. Most hosting companies have phpMyAdmin available from your hosting control panel and can normally be found by looking for “manage database” or similar.

Once you have accessed phpMyAdmin you will need to select the correct database, highlighted in the image below. If you are not sure which database WordPress is using, you can find the name by opening the wp-config.php file in the root of your WordPress directory and looking for “define(‘DB_NAME’, ‘XXX’);”, where XXX is the name of the database.

1

Now that you have the correct database selected you need to click “Export in the top navigation”.

2

Depending on the version of phpMyAdmin you are using you will have a slightly different layout in front of you. If you have a newer version, you can select  the “Quick” export method and under format select “SQL” as per the below image.

3

If you have an older version of phpMyAdmin, you will be faced with a larger set of options. Make sure that your settings match the image below.

4

Click ‘Go’ at the bottom to download the SQL file of your database. Save it in a memorable place on your computer so that you can find it for step 5.

Step 3 – Preparing WordPress for the new hosting

Unless your new database has the same name and user credentials as your old database, you will need to update the details in your wp-config.php file. Find the files that you downloaded in step 1 and locate wp-config.php which can be found in the root of your WordPress installation. Open the file in your chosen editor and look for the following:

// ** MySQL settings – You can get this info from your web host ** //

/** The name of the database for WordPress */
define(‘DB_NAME’, XXX’);

/** MySQL database username */
define(‘DB_USER’, ‘XXX’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘XXX’);

Your file will have the old login details in place of XXX. Replace these login details with the correct credentials for your new database. Be sure to enter these details correctly otherwise you will get a database connection error when trying to view the site. If you have not yet created your new database you will need to log into your new hosting and create a database and user. Information on how to do this should be available on your hosting company’s website. Once complete save the file ready for step 4.

Step 4 – Uploading your site

Now that we have edited the wp-config file, we are ready to upload all of the files to the new server. Connect via FTP to your new server and upload all of the files to the server. Again, this can be a lengthy process so feel free to start step 5 whilst you wait for the uploads to complete.

Step 5 – Uploading your database

We now need to upload the database that we exported in step 2 to the new hosting. Login to the control panel of your new hosting and find the section that allows you to manage your databases. You now need to import the file that was downloaded in step 2. If you are using phpMyAdmin you will need to first click on the database that you would like to use on the left hand side then click the import button in the top navigation.

5

Now click the choose file button highlighted in the image below and locate the file downloaded in step 2. Once selected click go at the bottom of the screen. Your database will now be imported.

6

Step 6 – Updating the site URL in the database

The WordPress database contains 2 records that determine the URL that the site should work on. Currently these 2 records will reference your old domain. To update these we need to open the wp_options table located on the left hand side of phpMyAdmin. This will show you all of the records within the table. We need to update the records with “siteurl” and “home” in the option_name column. The entry for “siteurl” should be the first entry in the table, highlighted below.

7

Click the edit icon on this row and change the URL to your new domain name. Be sure to include “http://” at the beginning a no trailing slash at the end. Once complete you will need to do the same for the “home entry”. This is usually found on page 2 and is highlighted below.

8

Do the same with this entry. Click edit, update the URL to be your new domain name and save the changes. We are now finished editing the database, phew!

Step 7 – Updating internal links

By this time your files should now be uploaded and all of the necessary changes to make your site work on the new domain should be complete. There is however one more piece of admin that needs to be completed. When content is created within the WordPress system and images are added to pages etc. WordPress links to these images using your old domain name. At the moment all of your content will link to images and resources hosted on your old domain. Luckily there is an easy way to update this. There is a great free plugin called “Velvet blues update URLs”.

Login to your new WordPress installation using your new domain name with /wp-admin on the end. You login credentials will be the same as on your old site. Once logged in click plugins on the left hand side and then click add new. Search the WordPress plugin repository for “Velvet blues update URLs”. You should only get one result. Click install and continue with the installation. Once installed click active plugin.

Now that the plugin has been activated there will be a new menu item under settings on the left hand side called Update URLs. Here you will find a screen that allows you to search the database for your old domain name and replace it with your new domain name.

Enter your old domain into the Old URL box leaving off “http://www.” from the beginning. For example, “yourolddomainname.co.uk” without the quotes! This will allow all www. and non www. links to be updated.

In the New URL box enter your new domain name, again leaving off “http://www.” from the beginning. For example, “mynewdomainname.co.uk” without the quotes!

Be very careful when entering the URLs as any mistakes can cause your content to display incorrectly. If you do face any issues, re-upload your saved database and start again.

You now need to select all of the checkboxes in step 2 except for “Update ALL GUIDs”. See the image below for reference.

9

Now click “Update URLs NOW”. You should see a report letting you know how many updates where made in the database. If the report says 0 make sure that you entered the old domain name correctly and complete this step again.

Step 8 – Testing the new site

You should now have a fully functioning website on your new domain. HURRAY! Spend some time now testing the site to make sure that everything functions correctly. Especially if you have any enquiry forms that email yourself or other people.

Once you are happy that the site is functioning correctly you are free to do whatever you wish with your old hosting. If you are keeping the old hosting you will need to remove the WordPress site from the old domain otherwise you will be penalised by search engines for duplicate content.

If you have any questions on the above or would like to share your experiences please leave a comment below.