Migrating a Drupal 7 Website to a New Host

Written by cloudways | Published 2017/04/28
Tech Story Tags: drupal | hosting | php

TLDRvia the TL;DR App

Are you currently hosting a Drupal 7 website on a live server? Are you unhappy with your current hosting provider for any reason? Do you face downtime or slow speed?

Almost everybody knows that migrating to a better performing host solves all these problems. However, many people do not make the move because they think that migration of Drupal website is a technically involved task.

In this tutorial, I will show you how to migrate your Drupal website to a new, more powerful host. For the sake of this tutorial, I have selected Cloudways. However, these steps are applicable to any host. The process involves the following steps:

  1. Backup website folders.
  2. Backup the database.
  3. Import the website’s backup.
  4. Import the database backup.
  5. Make appropriate changes in the settings.php file.

Backup Website Folders

The first thing you need to do is backup your entire website’s folder in order to avoid any loss of data. This is an essential step that ensures that in case of a disaster, the website remains operational.

To take the backup, connect to the present host server of your website through a FTP client such as Filezilla. You may need to contact your hosting provider to get the following details in order to connect to the server:

  • Server FTP host
  • Server FTP username
  • Server FTP password
  • Server FTP port number

Once the connection has been established, you will see all the files located on the server. In almost all cases, your Drupal 7 website will be situated in the public_html folder. Go into this folder, and copy the entire folder to the local machine. Filezilla will start copying all the files in this folder to the destination folder (located on the local machine).

Backup the Database

The next step is the backup process of the website’s database. This is a very crucial step since it deals with all the essential files and data of the website.

Almost all hosting providers use phpMyAdmin for database management. You may need to get help from your hosting provider in order to access phpMyAdmin.

Navigate to the website’s database in phpMyAdmin and create a backup. Use the ‘export’ option and save the backup file on the local machine.

Once done, proceed to the next step.

Import the Website’s Backup

Now go create a free account on Cloudways (if you haven’t created one already). You can signup and login using your Linkedin, Github or Google+ account.

Once done, create a new server.

The platform takes a few mins for server launch. Next, navigate to the Applications tab and select Add Application.

Select Drupal 7 from the drop-down list, name your app and create it.

Now that the server and the application has been launched, connect to your Cloudways server through a FTP client (I prefer Filezilla). Go to Server Management >> Master Credentials for server login information.

Once the connection has been established, navigate to your application in the Applications folder, and then into the public_html. Select and delete all the files in this folder.

Next, simply copy all the files from the backup created earlier and paste them in the public_html folder in the application’s folder.

Import the Database Backup

The next thing that you need to do is restore the database. Remember the database that you exported earlier? In this step,you will import it to the Cloudways server. But before you do that, you should delete all the tables already present in the new application’s database. To do that, navigate to your application’s main page on the Cloudways, where you will see a Launch Database Manager button.

Click the button and you will be brought to the built-in Cloudways database manager. Simply select all the tables here and click the Drop button at the bottom.

After all the tables have been deleted, click the Import button at the right side and browse to the database backup saved on the local machine.

Click the Execute button to import the database backup.

Make Appropriate Changes in the settings.php File

Now that the backups have been uploaded to the new server, it is time to make some changes to the settings. An important change is in the login credentials of the database in the settings.php file. The present credentials must be replaced by the database credentials of the Cloudways database. This is very important because incorrect credentials will not allow access to the website.

This is a fairly easy procedure. First, navigate to Sites >> Defaults. Edit the settings.php file using your prefered code editor. Avoid text editors because they could mess up the formatting of the file.

Scroll down to the uncommented portion of the code where database credentials are mentioned. Simply copy the database credentials from the application’s main page in the Cloudways platform and paste them in the appropriate fields in the settings.php file.

Final Thoughts

That’s it! You have performed a successful migration of a Drupal website (without breaking anything!). As you can see, migrating to another host isn’t as difficult as you though. Also note that, Cloudways provides one free migration for your website absolutely free of cost. What this means is that you don’t need to worry about any migration related problems, since Cloudways will do all the work for you.

I hope you found this post useful. Do let me know if you have any further queries and I would be happy to answer them.


Published by HackerNoon on 2017/04/28