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 Site to Another Host

Updated on December 8, 2021

16 Min Read
migrate wordpress

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!

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 migration 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.

Migrate WordPress Sites Manually

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!

Scared your website might break during migration?

No worries. Have a Cloudways Expert take care of it.

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.

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.

Launch PuTTY

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

Session inside the PuTTY

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

root admin

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.

list command

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.

cd var/www

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.

 zip command

Great! I have successfully backup 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. If you want to to know more about it,  request a Cloudways demo and our specialists would be happy to answer all your questions.

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


cloudways hosting

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.

Move WordPress Site to Cloudways

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.

Navigate to applications

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/ [email protected]:/home/master/applications/ewscfaavrd/public_html

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.

[[email protected]] 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.

Server Management

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

WordPress directory

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.

 zipped folder

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 [email protected]:/home/master/applications/ewscfaavrd/public_html

Import WordPress Database to Cloudways

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

Cloudways SSH terminal

-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.

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.

Sure Your Hosting Provider Isn’t Charging Extra?

Use the Web Hosting Savings Calculator for FREE to instantly find out the ideal host that fits your requirements best.

Migrate WordPress Sites 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:

WP-CLI installed

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

Debian 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.

Back up WordPress Files Using WP-CLI

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 sites from another hosting server to Cloudways and experience managed 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.

Industry-Leading Features

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.

Cloudways 24/7 Live Support

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.

Cloudways Intuitive User Interface

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 providers, 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.

Our Recommended WordPress Migration Best Practices

Now that you have learned all there is to learn about WordPress migrations, here are some recommended best practices that you should follow to avoid any inconvenience during or after the migration process.

Take a full backup of your server

Taking a backup is crucial to your WordPress migration because there are a lot of things that can go wrong during the migration process. You can easily lose your data with a minor glitch and all your years of hard work is gone to waste within minutes. So it’s important that you keep multiple copies of your database and your WordPress site so that you can easily restore the latest version if things go wrong.

Plan ahead

Migrating your WordPress site to a new host is not something to be taken lightly which is why it is important that you plan ahead and make sure that you are not running any campaigns on your website on the days of the migration. It’s always recommended that you migrate your site during low traffic season and even prepare a “Site Under Construction” page in case of some downtime.
Test your site after migrating

It’s important to always test your site’s performance once you have migrated it to a new host. With Cloudways, you have the option of migrating and testing your site during the trial period so even before you become a customer, you can see how your site is performing on Cloudways and then decide whether you want to move it permanently or not.

Check for quick fixes

It’s common for your website to not appear as it did on your previous host after the migration process. Once your WordPress migration process is complete, you must make sure that you check for broken links, breadcrumbs, sitemap, or any other quick fixes that your developer can take care of. Also, take some time and check your traffic after migration to see if your site is accessible to your users or not. You can also view bluehost alternative here.

Final Thoughts

I hope by now you know the simple process of migrating your WordPress site easily without losing valuable data. You can choose the option that best suits 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

Customer Review at

“Beautifully optimized hosting for WordPress and Magento”

Arda Burak [Agency Owner]

Mustaasam Saleem

Mustaasam is the WordPress Community Manager at Cloudways. 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.


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

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Cyber Week

Time Left In Offer
  • 0


  • 0


  • 0


  • 0


40% OFF

On All Plans