How to migrate a CMS to a new server or domain

If you are looking to move your site to a new hosting company, perhaps to change the URL of your website or setup a copy of the site for testing and development purposes this guide will give a general overview of how to go about this. The steps tend to be fairly similar for any content management system so this will point you in the right direction, though for specific tips we’d recommend checking out the documentation and community sites for the CMS you are using.

 Step 1 – Backup!

The importance of creating a backup of your site before making changes to it can never be overstated, using cPanel this can be done with just a couple of clicks and could save you hours if not days of work down the line. This process shouldn’t affect your existing site however mistakes can happen so it’s always best to be on the safe side.

 Step 2 – Export database via phpMyAdmin

Select phpMyAdmin in cPanel and click the name of the database you wish to export on the left, then click the Export tab. The default options are fine so you can just leave quick selected, then press the Go button which will download the database .sql file, make a note of where this downloads to on your computer.

Step 3 – Download website files

Login to your old site via FTP and download all files inside the public_html/ folder (assuming this is the main domain on the account, if it is an addon domain then you should download all files within the addon domain folder which is a subfolder of your public_html). You will need to upload these to the new site via FTP shortly.

Step 4 – Upload website files

You should now login to the new site FTP, and upload the files previously downloaded. If this is the main domain on a new account then these can go straight into the public_html/ folder, if it is an addon domain then you should put them inside the addon domain folder that you have specified in the cPanel Addon Domains section.

Step 5 – Create a new database

In the MySQL Databases section of cPanel you now need to create a new database

Then create a new user, making a note of the password.

Now add that user to the new database

Step 6 –  Import database via phpMyAdmin

Go to phpMyAdmin in your new account and select the new database you just created on the left. Now click the import button, then choose file and select the earlier database backup that we made, then click Go.

Step 7 – Edit configuration file with new database settings

The location of this file will vary depending on what CMS you are using, but the process should be the same for all CMS. You will need to locate the configuration file and edit this, changing the database name, database username and database user password, all of which you have previously created. The database name and database username will begin with your cPanel username followed by an underscore.

Common CMS configuration file locations (relative from installation directory):

Drupal – sites/default/settings.php

WordPress – wp-config.php

Joomla – configuration.php

Magento – app/etc/local.xml

Concrete5 – config/site.php

Step 8 – Edit the site URL in the database (URL changes only)

This step may not always be necessary, some CMS’s hardcode the site URL into the database when they are setup, if this is the case then when you visit the new site some links or the whole site may end up redirecting to the old URL. You should then go back into phpMyAdmin and select the new database, select the search tab and enter the domain surrounded by % signs, e.g. %domain.com% – You should edit any instances that show up in configuration tables to the new URL.

Step 9 – Finished!

Admire your work as you’ve just migrated your CMS successfully (with a bit of luck!)