Skip to main content
All CollectionscPanel
How to migrate a website between cPanel servers?
How to migrate a website between cPanel servers?
Ieva avatar
Written by Ieva
Updated over a week ago

This guide on single website migration between two cPanel servers will consist of 6 main steps:

1. Backup generation.

The recommended way to back up files is via using the Backup feature on the cPanel menu (Files -> Backup). For the backup generation, we have already prepared another guide here.

The most important part of this guide is in the second screenshot seen in sections “Download a Home Directory Backup” and “Download a MySQL Database Backup”. Here you should download the website file backup and the required database copy.

IMPORTANT NOTICE: If you will restore the database with the same name as the already existing one on the server, the data will be overwritten, so change the database name before generating its backup.

2. Preparing hosting plan for importing data.

To prepare the hosting plan for a new website, you should create the domain as an Addon Domain in the domain section. For this, we have also a guide prepared here.

3. Data restoration from backup.

Data restoration from backup is done from the same cPanel Backup feature as in the 1st step.

For the website file backup upload, select the “Browse” button in the section “Restore a Home Directory backup“. Pop-up will appear where you will have to choose the backup from your PC to be uploaded. Afterward the backing up will start automatically, and you will be re-directed to the website of restoration process status. From it go back to the Backup section and via the same steps initiate database restoration from backup in the “Restore a MySQL Database Backup” section.

4. Prepare the Database for usage.

After the backup restoration will be completed, you will have to create a database user and assign it to the related database.

These actions will be performed via the “MySQL® Databases“section of the cPanel Databases management section. Firstly, adding a new user can be done in the “Add New User” section in the “MySQL Users” part of MySQL® Databases. You can create the same user as your database has used on the previous server, but it is not mandatory. When you will create the user, save its username and password since we will need them in the following step of this guide. After the user will be created, use the “Add User to Database” section of this page. From the User menu, select the newly create a user and in the “Database” menu choose the database that you have uploaded and press “Add“. This will link the new user with the database.

5. Finalizing the website transfer to the server.

After performing previous steps, your website files should by default be uploaded to /var/home/your_user/public_html/new_domain.tld directory. Because the old and new servers will probably be different, you will have to adjust the website configuration file, so that the old website would be compatible with a new hosting plan. For the most popular CMS, we have prepared a list of files that are used as configuration files, that has to be inspected and adjusted:

For Joomla: configuration.php. Important lines are var $db, var $user and var $password. These lines should contain database name, database user and database password accordingly.

For WordPress: wp-config.php. Important lines are define(‘DB_NAME’, ‘****’); , define(‘DB_USER’, ‘****’); , define(‘DB_PASSWORD’, ‘****’); and define(‘DB_HOST’, ‘****’);. Database name, user and password accordingly. DB_Host field should be set as “localhost”.

For Drupal: sites/default/settings.php. Important lines are ‘host’ => ‘localhost’ , ‘database’ => ‘****’, ‘username’ => ‘****’, and ‘password’ => ‘****’, .

For Prestashop: /config/settings.inc.php. Important lines are define(‘_DB_SERVER_’, ‘localhost’);, define(‘_DB_NAME_’, ‘****’);, define(‘_DB_USER_’, ‘****’); and define(‘_DB_PASSWD_’, ‘****’) .

For OpenCart: config.php. Important lines are define(‘DB_HOSTNAME’, ‘localhost’); , define(‘DB_DATABASE’, ‘****’); , define(‘DB_USERNAME’, ‘****’); and define(‘DB_PASSWORD’, ‘****’);.

6. Ending the transfer via DNS change.

For the website transfer to fully take place and be seen publicly, you should adjust your website domain DNS records, by pointing them via A type records to your ordered hosting plan IP address. This IP address can be seen in the cPanel management page section General Information, by opening the link “Server Information” on line “Shared IP Address”. The change for the DNS records should be done via your domain registrar system or another system if you use custom DNS servers.

Did this answer your question?