Here is a step by step guide to moving WordPress to a new server using the free Duplicator plugin, which makes migration a much simpler process.

Initialize Your New Server

You do need to configure your new server so that you have a new IP address to point your test domain to (described later). You might use our Guide to Installing WordPress at Digital Ocean to set up a new server. With the Duplicator plugin, you do not need to install WordPress on the destination server. So, you can stop the tutorial steps right before the Installing WordPress section and return here.

You can also sign up for an account at Digital Ocean. If you’re looking for a quality domain name registrar, I prefer NameCheap.

Also, check out our WordPress Quickstart: it’s an optimized WordPress image pre-configured with Varnish Cache and W3 Total Cache as well as a set of recommended plugins.

When you’re moving WordPress, it’s a good time to explore other hosting options. I often recommend WP Engine as a robust managed hosting provider. Their plans start at $29 per month and often have discounts.

Sign up for Digital Ocean

Preparing WordPress for the Migration


Your WordPress site has four major components that you will need to migrate:

  1. Domain name records pointing to your current server e.g. A record pointing to
  2. Configuration files, such as the Apache site conf file and any custom PHP ini settings. If you’re moving from a managed host such as WP Engine, then you’ll have to create these from scratch as shown below.
  3. Your WordPress files: the WordPress code itself, your theme files, plugins, file uploads and .htaccess file.
  4. Your WordPress database

This tutorial will guide you through the process of moving each.

How to Move WordPress to Digital Ocean

Reduce Your Domain Name Time to Live (TTL)

First, to make moving and testing your WordPress configuration easier, set the TTL of your domain name to 300 seconds (5 minutes) in your DNS. The TTL tells Internet name servers how frequently it should check for a new location.

Having a shorter TTL makes it easy to point your domain at the new server and then switch it back to the old server if you encounter any problems. It also ensures that you can start publishing on your new server quite quickly. If you don’t set your TTL, you might have hours of downtime.

Visit your DNS or domain name registrar to do this:


It’s best if you can change the TTL for your domain name a day before you migrate your site – but even a few hours ahead is fine.

Set Up a Test Sub-Domain For Your New Server

Create a sub-domain or test domain name with DNS A record pointing to the IP address of your new server. This will only be used to verify that the new site works before you switch over your primary domain name. e.g. create an A record for pointing to the IP address of the new server you set up above such as

Optionally, you can create a second sub-domain pointing at your old server – which can be useful for logging in and accessing files after you complete the transfer. e.g. A record to the old-ip-address.

Install the Duplicator Plugin

On your existing WordPress site, using your Dashboard menu, select Plugins -> Add New. Search for Duplicator. Click Install Now and Activate it:

add_duplicator After activation, click the Duplicator menu item in the Dashboard. You should see something like this:



Use Duplicator to Backup Your Site

Using Duplicator, click Create New, which will create backups of your WordPress directory tree and database. Click the Installer section and enter your test domain name in the new site URL. Then click next. Duplicator will scan your system and point out any adjustments that you need to make. When you’re ready, click Build.

The process will resemble the images below:

Once you’ve completed the package creation, click the Installer link to download it. Then click the Archive link. Preserve a copy of these files, as they are essentially a backup of your site. You will also need them to move your site to the new server.

If your site is small, this will work just fine. If your site is large, your PHP.ini settings may not allow such a large, time consuming download. Here a few options:

Modify Your PHP File Settings

One option is to allow your PHP installation to allow longer connections. Edit your PHP ini file:

nano /etc/php5/apache2/php.ini

Temporarily, change the execution time to 600 seconds:

max_execution_time = 600 ; from 60

Reload Apache:

service apache2 reload

Use SCP to Transfer the Files to Your New Server

You can also use SCP to transfer files from your old server directly to your new server. Login with SSH to your existing WordPress server and use scp to transfer the files to your new server instance:

cd /var/www/yoursite/wp-snapshots
scp -r .

Use WGET to Download the Files to Your New Server

Another option is to log in to your new server and use WGET to download them over http from your old server. The paths are listed in the package description area. Larger files will only transfer if your PHP execution time has been extended as described above.

Log in to your new server via ssh, and do the following:

cd /var/www/yoursite

Prepare Your New Server

Install Unzip

Unzip will likely be necessary for Duplicator to decompress your site archive:

apt-get install unzip

Create Your Apache Configuration File

Create the directory for your WordPress site on the new server:

mkdir /var/www/sitename

Create the Apache configuration file for your site. Be sure to add a ServerAlias that supports your test subdomain or test domain. WordPress .conf files look something like this, but you can also use a copy of the one on your existing server.

nano /etc/apache2/sites-available/yoursite.conf

Paste and customize your .conf file:

<VirtualHost *:80>
   ServerAlias *
   DocumentRoot /var/www/sitename
   DirectoryIndex index.php
      <Directory /var/www/sitename/>
      AllowOverride All
      Order Deny,Allow
      Allow from all

Tell Apache to enable your site and reload:

a2ensite yoursite.conf
service apache2 reload

Prepare Your Database and Permissions

Duplicator requires that you create an empty database and configure the permissions for it to install your existing site on the new server. You can do this easily with the MySQL administrator command line:

mysql -uroot -p
mysql> create database db_name;
grant all privileges on your_db_name.* TO "your_db_user"@"localhost" identified by "your_db_password";
flush privileges;

If you’ve installed PHPMyAdmin on your new server, you can also use it to do this.

Make a note of your  database settings somewhere safe. You will also need to enter them when you run the Duplicator installer below.

Run the Duplicator Installer

Duplicator will require temporary directory permissions to your site:

chmod -R 777 /var/www/yoursite

In your web browser, visit your test site e.g. You should see something like this:


Step through the installation process, entering your database access permissions from above. Duplicator will import your SQL database from the archive into your new database server (in the examples below is my test url):

Verify Your New WordPress Site

Using your browser, visit your test domain name again e.g. http:/// You should be able to browse your entire site correctly. If you’re satisfied that the site has transferred correctly, you can continue. If not, you can post a comment below or visit the Duplicator plugin support area.

Note: If you’re using an .htaccess file in your old WordPress configuration, make sure that a correct copy of it was moved over to the new server. Sometimes files with the period prefix are lost in the transfer.

Cleanup and Secure Your New WordPress Site

First, we need to remove any remaining files from the Duplicator installation process. Log in to your new server and remove the Duplicator files:

cd /var/www/yoursite
rm installer*

Then, we need to secure the permissions on your WordPress directory:

find /var/www/sitename -type d -exec chmod 755 {} \;
find /var/www/sitename -type f -exec chmod 644 {} \;

Complete the Transition to Your New Server

Changeover Your WordPress Site URL

Using your new WordPress dashboard via your test sub-domain name, navigate to Settings -> General. Change the test domain name to your primary domain name. When you save the settings, your site will stop working temporarily until the DNS has caught up.

Point Your Domain Name to the New Server

Switch your domain name DNS to point to the new server. Change the A record to point to the new IP address. With the reduced TTL setting, you should start to see the new server running your site within a few minutes.

You can check that your DNS has changed over by pinging:


Or, by using a web-based DNS lookup service such as Kloth.

Verify Your Site on the New Server

Using your browser, test that your site has completely restored to the original domain on the new server. e.g.

Note: I have noticed that using my approach, some themes settings may not change the URL back from the test URL to the original URL as desired. You may need to manually review theme settings to ensure that everything has switched back. In the worst case, you may want to browse the settings in your wp_options database table using PHPMyAdmin.

Archive Your Old Server

Once you’ve verified that your new server is running properly, you can decommission your old server. If you were running on a service such as Amazon AWS, you can create a final snapshot of your instance. If you’d like to make a manual snapshot do the following:

cp /etc/apache2/sites-available/yoursite.conf /var/www/yoursite
tar cvzf yourarchive.tar.gz /var/www/yoursite/
mysqldump -u root -p your-wp-database > wp-db-backup.sql

From your local machine, use scp to transfer the files home (this is where it may be useful to have a backup domain pointing to the old server IP address):

scp -r root@your-old-site-ip-address:/var/www/yoursite/*.gz .
scp -r root@your-old-site-ip-address:/var/www/yoursite/*.sql .

Congratulations, you’re done! Enjoy your new server!

What’s Next?

You may want to explore our optimization tutorial for your new server. You should also ensure that you have some kind of backup system running on the new server.


About The Author