28 March, 2020

How to Move Your Wordpress Site From One Server ( or localhost) to Another Server?

Simple steps to deploy existing WordPress site
Hey everyone,
  • Do you want to migrate your WordPress site to a server from localhost?
  • Do you want to move your site from one server to another?
If one of your answers is Yes then you are at the right place. This article will surely help you.

You need to follow some simple steps in the correct order :

  1. Create a backup of your WordPress site
  2. Move backup to your new server
  3. Setup site on the server
  4. Redirect site to your domain


1. Create a backup of the site

First, we need you to backup your site to move this on a new server. For this, we are using a Wordpress plugin, called Duplicator.
Duplicator has a great rating on WordPress repository and it's free as well. Feel free while using this plugin because it will take the backup of all your database, themes and plugins as well.

So for backup, you have to follow the following steps :

1. Download and install Duplicator plugin on your local site
You can download the duplicator plugin from your WordPress site dashboard.
From dashboard navigate to Plugins ➡ Add New ➡ Search Duplicator ➡ click on Install Now ➡ click on Activate.


2. Create a new package
Now you can see Duplicator in your dashboard. To create a new package, navigate to Duplicator ➡ Packages ➡ Create New .


Here we have three steps :

1-Setup : Click on the Next button to start the process.


2-Scan : Click on the Build button.


3-Build : Now download both the Installer and Archive files.


You can follow these steps also to backup your site. Now, we need to move our backup (these two files) to the server.

2. Move your backup to the server

Let’s move your site to the server so that various approaches can be used. You can use your FTP client also, but here we are using an rsync command to send files from local to the server. For error-free installation follow given steps :

  1. Move your Installer and Archive files in a new folder. We have named it my_site .
  2. Now run the below command to move my_site folder on server:
  3. $ rsync -avzhe ssh /my_site/ [email protected]:/var/www/html/

    Here 0.0.0.0 must be replaced with your server IP address. Also /var/www/html directory is available on your server.
After running the command you can log into your server and check that files are available there.

3. Setup site on the new server

All your local work has been finished. Now, let's set up your site at the server by simple steps:

  1. You need a database on the server. So, now create a new database for your WordPress site using MySQL or PHPMyAdmin on your server.
  2. Fire up your browser and navigate to http://YourServerIP/installer.php

NOTE: If you got a permission error change the owner of your project directory on the server by running the following command :

$ chown www-data:www:data /var/www/html/my_site

Here we have four steps for setup our site :
Step - 1 :
Here you can see the interface of installation. You need to accept the terms and click on Next button.


Step - 2 :
In this step, you need to configure your database by putting the database name with user_name and password of your database. Now test the database and click Next button.


Step-3 :
Here no need to change just click the Next button.


Step-4 :
Click on the Admin Login button and you see your WordPress website is live now.


Your Website is live now
Your WordPress site is live on http://your_server_IP/my_site . You just need to put your Username and Password to login to your wp_admin dashboard.


4. Redirect site to your domain

Now you need to configure your site to your hostname. So whenever your visitors type your website hostname they redirect to your website.

  1. First, you need to change your Wordpress URL and Site URL from your WordPress dashboard and save this.


  2. Now we need a virtual host on our server. For this we are going to use apache server. You just need to create a conf in /etc/apache2/site-available/ for your website. A sample conf file for my site my_site.conf is given bellow :


  3. Make Sure you enable the conf site. For this you need to use following command :
  4. $ a2ensite my_site

  5. Now restart apache server :
  6. $ service apache2 restart

Now fire up your browser and navigate to https://your_host_name.com . Here you can see your site is working properly.

Congratulations !! your wordpress website is successfully deployed on the server and now you know how to move wordpress site on the server.

blog comments powered by Disqus