Categories: Drupal 7 Tutorials, Tips and GuidesDrupal Tutorials, Tips and Guides

How to Migrate Your Drupal 7 Website to a New Host

Reading Time: 5 minutes

How to Migrate Your Drupal 7 Website to a New Host

If your website is running slow and you have tried all the necessary steps to improve its speed but to no avail, then the only option left to you is hosting migration, but before that don’t forget to create a backup of Drupal 7 website.

Every web administrator knows that migrating to a better host can solve slow speed woes. But they are still reluctant because migration is arduous.

However, there are ways in which you can migrate your website faster. In this tutorial, I will show you how to migrate your Drupal 7 website to a new and more powerful host by using simple steps.

The process involves the following steps:

Backup Website Folders

Backup the Database

Import the Website’s Backup

Import the Database Backup

Make Appropriate Changes in the settings.php File

Final Thoughts

Backup Website Folders

First backup your entire website’s folder to avoid data loss. This is essential to ensure that the website remains operational and no data gets lost.

Connect to the present host server of your website through an FTP client such as Filezilla to take the backup. You will need to contact your hosting provider in order get the following details:

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

Make a connection with the server…

Once the connection is established, you will see the files on the server. Your Drupal 7 website will be situated in the public_html folder. Locate it and copy the entire folder to the local machine.

Backup the Database

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

If you are using phpMyAdmin for database management, get help from your hosting provider in order to access it.

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

Once done, proceed to the next step.

Import the Website’s Backup

Visit www.cloudways.com and create a free account (if you haven’t created one already).

Start a new server.

The platform takes a few minutes to launch a server. Navigate to the ‘Applications’ tab and select ‘Add Application.’

Select Drupal 7 from the drop-down list. Now add a name for your app and create the application.

Now that the server and the application have launched, connect to them through an FTP client (I prefer Filezilla).

Go to Server Management >> Master Credentials to get server login information.

Once the connection is established, navigate to your application in the Applications folder, and then to 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 into 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 that, delete all the tables already present in the new application’s database.

Delete the tables by navigating to your application’s main page on Cloudways. 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 preferred 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 on the Cloudways platform and paste them in the appropriate fields in the settings.php file.

Final Thoughts

That’s it. You have successfully migrated Drupal 7 website.

As you can see, migrating to another host isn’t as difficult as you thought.

Also, note that Cloudways provides one free migration for your website absolutely free of cost. This means that you don’t need to worry about 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.

Hamza Zia :Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.