Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Migrate WordPress Website to Another Host

January 8, 2019

16 Min Read
Reading Time: 16 minutes

Moving a WordPress site from one host to another can be a complex task (and may even pose a few threats) if you don’t know your way around it. However, website migration should be a straight forward process and even if you face a problem or two you should be able to tackle it easily on your own.

In this tutorial, you’re going to learn how exactly to migrate a website to another host without any complications!

  1. Migrating WordPress Manually
    1. Uploading WordPress Files
    2. WordPress Database Migration
    3. Tackling The Tricky Bit
    4. Finalizing The Process
    5. Settling In
  2. Migrating WordPress Site Using SSH
    1. What Is SSH/Command Line?
    2. Accessing the Command Line
    3. Navigating to WordPress directory
    4. Taking the WordPress files Backup
    5. Taking the Database backup
    6. Installing WordPress on the New Server
    7. Moving WordPress Site to New Server
    8. Importing Database to New Server
  3. Migrating Via WordPress Command Line
    1. What Is WordPress Command-Line?
    2. Taking the WordPress files Backup
    3. Import WordPress Files to Cloudways
    4. Taking the Database backup
    5. Searching and Replacing URLs on New Server
  4. Test and Run the WordPress Site
  5. Migrate WordPress Using Cloudways Migrator Plugin
  6. Why Migrate WordPress to a New Server

The biggest problem you can face while migrating your website is the loss of data. If you lose important data while transferring your files, chances are that you’ll mess up your website!

Note that there are some useful plugins that can help you do the job easily. And if you are opting for managed WordPress hosting, they will move the site for you. So make sure you check these options as well. In addition, it’s always better to backup your website with a WordPress backup plugin before migrating.

Also, this guide can prove to be a tedious process for some people, so in the end, you can see how moving your site to Cloudways can be done in just 3 easy steps!

For now, though, let’s focus on the steps to help you migrate your website to another host without any hiccups!

Migrate WordPress Manually

The biggest problem you can face while migrating your website is the loss of data. If you lose important data while transferring your files, chances are that you’ll mess up your website!

Note that there are some awesome plugins that can help you do the job easily and many hosting companies, like Cloudways itself, will move the site for you, so make sure you check these options as well.

Also, this guide can prove to be a tedious process for some people, so in the end, you can see how moving your site to Cloudways can be done in just 3 easy steps!

For now, though, let’s focus on the steps to help you migrate your website to another host without any hiccups!

I) Upload The Files

The first step is to upload the files. You have two options for uploading the files to the new host.

FTP Based Method

Login to your existing hosting account, navigate to the File Manager, and into the folder with the WordPress files. Compress (zip) all your WordPress files, and then upload the zip file to the new hosting provider either through the File Transfer Protocol (FTP) client or the File Manager provided by the new hosting account. Once uploaded, Extract the zip file in the public_html folder.

SSH Method [The Fastest Way]

The files can also be uploaded through SSH. Not all providers offer this service, and you should check for the platform-integrated SSH terminal. If it’s not available, use a client such as PuTTy to connect to the new server. Use the following command:

 $ cd public_html/

Once connected to the server, access the public_html folder ( the root folder for the WordPress files). Inside this folder, upload the folder you zipped earlier in the FTP method.

Go to your File Manager and make sure that your zipped folder is inside the public_html folder. By default, it’s named, but you can change it to something like Now verify the location by accessing the URL. When the correct URL is accessed, the will start downloading automatically.

The generic URL might look like this:

Now go back to the PuTTy terminal, and enter the following command (make sure that you are still in the public_html folder):


Once downloaded, you will see a new zip folder in your public_html folder of your new host. To unzip the folder, run the following command.


If you’ve done it correctly, all the files from your old sites should be imported to your new hosting. Follow the next step to migrate the Database.

II) WordPress Database Migration

Create a new database and a user at the new hosting server using the MySQL Database Wizard (note down the credentials as you will need them later on).

Go back to the old WordPress site, install the UpdraftPlus plugin to Export the database.

Backup WordPress Database

Using phpMyAdmin on the new hosting account, Import the database created above.

Import Database File

III) Tackle the Tricky Part

Simply go to wp-config.php (you can find it in root) and replace the credentials with the one you earlier noted, i.e., DB_NAME, DB_USER, DB_PASSWORD. In some cases, you need to provide DB_HOST while moving a WordPress site to a new host, but that mostly depends on your server. Other than that, you are ready to go!

Update wp-config Database Credentials

IV) Finalize the Process

Find the table xxxxx-option in your database, and replace option_value of siteurl and home with the new URL of your site.

Change siteurl and home

You can now visit, go to Settings and select Permalinks and change it as per your desire.

V) Settle In

You can use the Velvet Blues Update URLs plugin to amend every old URL to new URLs. Once done, you’re good to go! Voila, you’ve migrated your site to your new host and are ready to take advantage of your new environment!

VelvetBlues WordPress Plugin

Note: If you are unable to visit the site, try clearing your browser cache.

2) Migrating WordPress Site Through SSH

I) What Is SSH/Command Line?

SSH is a command line interface, widely used to control remote machines (in this case, the servers are both the current and future homes of your WordPress website). Shell commands are used to execute a range of actions on remote servers. It is not interactive and only accepts text commands for the operation you wish to perform.

SSH provides a secure and encrypted channel through which information is shared between the client and the remote server. Because of the popularity and almost universal use, an SSH terminal is integrated into iOS and Linux OS. Windows users need to download an SSH-client ( such as  PuTTY) to initiate SSH sessions.

Unfortunately, the majority of WordPress users are not familiar with the command line interface. Therefore, I will use very simple steps to walk you through the rest of this guide. I will also explain the behind-the-scenes working of the commands, giving you a better idea of what you are doing.

IdeaBox – Case Study

Read how Cloudways Helped a WordPress Agency Build Better Products.

Thank You

Your Ebook is on its Way to Your Inbox.

II) Access the Command Line

For the purpose of this tutorial, I will use the SSH-client PuTTY for accessing the command line. However, you may use any SSH-client of your choice. You would require the following to access your existing server through the command line:

  1. Server IP address
  2. Username
  3. Password
  4. Public key

Launch PuTTY, and navigate to SSHAuth.

Now, get the public key of your server and navigate to Session inside the PuTTY window to enter the IP address of the server.

Click the Open button and log in with your credentials. (Important: log in as a root admin and enter the correct password).

c) Navigate to the WordPress Directory

The first thing I need to do after logging into the server through SSH is to navigate to my WordPress site directory that contains the files and folders that I want to move to the new host.

In the terminal, type the following command that ensures that I am at the root of the server.


The next command is ls, short for the list command that displays all the files and folders in the root folder.

You might see a different list of files and folders which is fine. From here, you need to go to the  WordPress installation folder. In my case, I will go to the www folder (containing the WordPress installation files) inside the var folder.

Type cd var/www and hit Enter.

Upon checking the content of this folder by running the ls command, I can see that it contains the folder for the WordPress site.

Simply type cd wordpress (or whatever the name of your folder is) to gain access to the WordPress site folder.

VI) Backup WordPress Files

The WordPress folder contains a lot of folders and files and backing them all is important before I actually initiate the process of migrating the WordPress site. For this, I will create a zip folder of the WordPress site folder. This is the easiest and the fastest way of transferring data from my existing cloud server to the Cloudways managed server.

Note: In order to run the zip command, make sure you have zip installed. You can install zip by running the following command: sudo apt install zip unzip

While in the www folder, run the following command:

zip -r wordpress

-r  flag enables recursive reading of files. Do not forget to replace the name of the folder [wordpress]  and the filename  [] to match yours.

After the process completes, cd back to the www folder or the folder in which you ran the zip command, and type the ls command to confirm that the zip file has been successfully created.

Great! I have successfully backuped my WordPress site. Let’s move ahead and take the backup of WordPress database.

V) Backup the WordPress Database

In order to create a backup of the MySQL database, go back to your SSH terminal and type the following command:

mysqldump --add-drop-table -h localhost -u wpuser -p wordpress > site.bak.sql

In the above command, I have supplied the following parameters. Please adjust them to match your values.

-h localhost will stay the same

-u is the username of the MySQL database

WordPress is the name of the database.

Supply the password after running this command. Once the command is executed, you will notice that a new file has been created (with the name ‘site.bak.sql’). This contains the complete database of our WordPress site.

At this point, I have successfully created backups of WordPress files and database. Let’s see how I  will move WordPress site to a new host.

VI) Launch WordPress on Cloudways

Before I proceed with the rest of the WordPress migration, let’s set up the server and launch a WordPress site on the Cloudways Platform.

It takes a few clicks to deploy a new server and launch a WordPress site on Cloudways.

Start by signing up for a Cloudways account and choose the desired flavor of WordPress site from the drop-down menu. Name your application, server, and the project.

Choose the cloud provider, data center location and then click the Launch Now button. Within a few minutes, your server and the WordPress website will be deployed.

That’s it! The WordPress site is up and running on the Cloudways managed server. Let’s migrate the existing site to the new server.

VII) Move WordPress Site to Cloudways

I am now all set for initiating the migration process. In this process, I will migrate the zip file containing the backup of the WordPress files from my existing folder to the new WordPress site I have launched on Cloudways.

Before I proceed, let’s connect to the Cloudways server via FTP using FileZilla. This way, I can easily monitor the files and their location. For that, I will launch FileZilla, navigate to Server Management from Cloudways Platform and copy its Public IP, Username, and Password.

Now, enter the credentials in FileZilla to access the server. Navigate to applications[your wordpress site folder]public_html folder and delete all the contents of this folder. This generally takes a few minutes. Once done, I will move the contents of my WordPress website to this location.

In the next step, go back to the SSH terminal and make sure that you are in the www directory. Next, run the following command:

scp /var/www/ master_prgaekpebs@

Let’s see what’s going on with this command:

scp [var/www/] this is the location of the file I wish to send to my new Cloudways server. Please change it to match yours.

[master_prgaekpebs@] text before the @ sign is the username of my new Cloudways server and after the @ sign is my public IP.

[:/home/master/applications/ewscfaavrd/public_html] this bit of the command represents the location where I wish to copy the zipped WordPress folder.

Once the command finishes, you will see a new file inside the folder:

Finally, I need to unzip the content of this zipped file. To do so, go back to your Cloudways platform and inside Server Management, launch the integrated SSH terminal.

Log in with the username and password (provided as Master Credentials) and navigate to the WordPress directory where I just copied the zipped folder.

Using SSH for unzipping the folder is fast and easy. Go to the public_html folder of the application where the zipped folder was copied from the old server, and run the following command to unzip the contents.


Once the process is completed, run the ls command to verify the content of the unzipped folder.

Note: Do not remove/delete the zipped folder as it may be required in case if things go south. When you have verified that everything is working as it should, delete the folder later on.

I have successfully transferred the WordPress site to the new Cloudways managed server.

However, if take a closer look, the location is not right. In order to serve this site, I should have the content inside the public_html, not in a folder inside the public_html directory.

To move all the content from WordPress folder to the parent directory public_html, run the following command inside the Cloudways SSH terminal while in the WordPress directory.

mv * ../

The mv command is used to move files/folders, the * represents all files/folders, and ../ is to go one step back.

Run the ls command to confirm that all the files and folders have been successfully transferred.

As you can see, I have successfully moved the WordPress site to its new server.

VIII) Import WordPress Database to Cloudways

Let’s transfer the .sql file from the old server to the public_html folder of our new WordPress site on Cloudways. I will use the the scp command.

Note: This will replace/override the existing database on the Cloudways server with the database on the old server.

scp /var/www/site.bak.sql master_prgaekpebs@

Now, go back to Cloudways SSH terminal window and run the following command to import the database file.

mysql -u ewscfaavrd -p ewscfaavrd < site.bak.sql

-u ewscfaavrd This is the database username of the WordPress site on Cloudways.

-p ewscfaavrd This is the database name of the WordPress site on Cloudways.

At this point, I have moved the WordPress site files and database to the Cloudways server. Let’s go ahead and check if the WordPress site is properly operational. For this, simply click the application URL under the APPLICATION URL section.

While browsing the website, I came across the error page which tells me that my WordPress site is unable to connect to the database.

This issue can be fixed by replacing the old database credentials inside the wp-config.php file with the new credentials provided by Cloudways.

Launch FileZilla (if you closed it earlier) and open the wp-config.php.

Inside the file, replace the values of DB_NAME, DB_USER, and DB_PASSWORD, save and close the file.

Now go back and reload the page, and the website appears to be running fine.

As you can see, I have successfully moved the WordPress site and its database from my old server to its new hosting server.

The entire process might feel a bit lengthy, but it’s faster and secure. Now, if you have a small website, use the Cloudways migrator plugin for no-issue migrations.

3) Migrate WordPress via WP-CLI

As discussed earlier, I will also cover the migration process using WordPress Command Line or WP-CLI for short.

I) What is WordPress Command Line?

Like SSH, WP-CLI is a command line interface specific to WordPress. This simple yet powerful tool allows you to operate the CMS in pretty much the same manner as the WordPress frontend. Because of the flexibility and simplicity, WP-CLI is the preferred way many WordPress developers and users interact with the CMS.

WP-CLI is used to transfer WordPress sites, install plugins, manage a multisite network, access databases and upgrade the core files. Although all of the above tasks can be performed via the web interface, it is still a preferred way of performing tasks without distractions.

Open your SSH terminal and make sure that WP-CLI is installed on the server. For that, simply type the WP command below:

wp --info

Since I do not have WP-CLI installed, the following error will appear:

Let’s fix this by installing the WP-CLI. Run the following command in the SSH terminal of your old server. cd back to the opt folder by going all the way back to the root location. Keep running the cd ../ command until you reach there.

Install wp-cli by running the following command:

curl -O

This should install the WP-CLI. Next, confirm this typing the wp –info command.

Now, change the file’s permission to make it executable.

chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Go back to the main WordPress folder and run the following command that should shows the version of WordPress installation.

wp core version --allow-root

Great! Let’s go ahead and take the backup of our WordPress site using WP-CLI.

II) Back up WordPress Files Using WP-CLI

Taking a backup using WP-CLI is similar to the SSH based process. Navigate to the www folder and create a zip file of the WordPress site by running the following command.

zip -r wordpress

Move the zipped folder inside the WordPress site folder by running the command below.


where wordpress is the name of the WordPress site.

Now, go  to the wordpress folder by running the cd command and you will find the folder.

The following screenshot summarizes the whole process.

I have moved the zipped folder inside the WordPress site folder so that it can be accessed through a URL. It should be downloadable from the URL like this:

http://[serverIP]/ OR http://[wordpress site location]/ depending upon your structure.

III) Import WordPress Files to Cloudways

Log into your Cloudways platform and launch the SSH terminal. Navigate to the new WordPress site and inside the public_html folder, type the following command.

wget http://[serverIP]/

This will fetch the complete zipped folder from the old server through a URL. Once the transfer finishes, unzip the content of the folder by running the following command:


This will move all the content back to the parent directory (public_html) by running the following command.

mv * ../

There you go! I have successfully fetched the zipped folder and moved the WordPress site to the new host.

IV) Take the Database Backup

The database can be backed up easily:

Run the following command to create the .sql file for your WordPress MySQL database.

mysql -u ewscfaavrd -p ewscfaavrd < site.bak.sql

This will create the backup file that can easily be exported to Cloudways server using integrated SSH shell.

V) Search and Replace URLs (If You are Moving a Site to a New Domain)

In case you are migrating to another domain, you will also need to replace the URLs pointed to your old domain through a simple process.

In the Cloudways SSH terminal, run the following command:

wp search-replace "" ""

This command will first search for all the URLs and then replace them with the new URL provided in the later part of the command.

Test the WordPress Site

If you have followed along and did not encounter any roadblocks, you should be able to see your migrated site up and running on your new Cloudways server without any issues.

It is always a good idea to cleanup a bit after finalizing the migration process. For this, delete the zipped folder of the WordPress file as well as your MySQL database. This is totally optional and if you are not worried about disk space, leave them alone.

Migrate WordPress Sites to Cloudways in Three Steps!

As I mentioned earlier, if you’re migrating your site from some other host to Cloudways, the process has just three simple steps!

  1. Install Cloudways WordPress Migrator on your current hosting server.
  2. Enter the necessary credentials.
  3. Click Migrate.

Here is a short video guide on how you can easily migrate WordPress from another hosting server to Cloudways and experience managed optimized cloud servers.

Migrate WordPress to Cloudways in 3 Steps!

As mentioned earlier, if you’re migrating your site from another to Cloudways, you can do so in 3 simple steps!

  1. Install Cloudways WordPress Migrator on your current hosting.
  2. Enter the necessary credentials.
  3. Click Migrate.

Here is a short video guide on how easily you can migrate WordPress to another host (Cloudways) and experience the speed of optimized cloud servers.

Brilliant, isn’t it? It’s easy, simple, and saves you time!

Let’s briefly check out some of the features Cloudways offers to its customers.

Industry-Leading Features

Cloudways Platform comes loaded with useful features which enable the users easily manage the services like deploying multiple applications on a server, creating staging sites for testing out website updates, integrating free SSL certificates, free cache plugin and CloudwaysCDN, add/manage team members, SFTP access and IP whitelisting, etc.

24/7 Live Support

Support is essential for uninterrupted operations of any business. Cloudways ensures that the customers always have access to 24/7 live chat support. Besides this, Cloudways customers can also get instant support from our knowledge base as well as from the active community that pitches in to help fellow Cloudways users.

Intuitive User Interface

The Cloudways platform is very easy to use and even a non-techie can find their way around with no hassle at all. Navigating through the server and application settings is very simple and complex options are explained via hints and tooltips.

Multiple Add-ons

Besides a ton of built-in features, Cloudways also offers the option to integrate add-ons that best suit user requirements. These add-ons can be used for integrating email provider, DNS services, extended app-level support, migrations and the robust Cloudways API for developing, integrating and managing your server.

System Integration

Cloudways users also enjoy the integrations for monitoring their server and application health via CloudwaysBot and New Relic APM. These tools offer detailed website performance analysis and help users improve application performance.

Final Thoughts

I hope by now you know the simple process of migrating your WordPress site easily without losing valuable data. You can chose the option that best suit your requirement for migrating your WordPress site to a new server.  Go ahead and brag about the skills you acquired from this article. Command line is fun and if you are interested in more useful commands, feel free to explore the internet.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Mustaasam Saleem

Mustaasam is the WordPress Community Manager at Cloudways - A Managed WordPress Hosting Platform, where he actively works and loves sharing his knowledge with the WordPress Community. When he is not working, you can find him playing squash with his friends, or defending in Football, and listening to music. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019