Why would you want to create an exact copy of your WordPress site? Shouldn’t this unique piece of art stand above being treated as a mere commodity?

Well, while this is definitely an apt (and in no way overblown) description of your work, there are actually several good reasons to make a duplicate of your site:

  • Moving from development on your computer to production server or the other way around
  • Migrating to a different provider
  • Creating a backup
  • Setting up an online testing environment or staging server
  • Using a copy of an existing site for a similar project

Sound convincing? I knew we could agree on this.

Generally speaking, making a duplicate of your WordPress site involves the following steps:

  1. Making a copy of your files and database
  2. Moving them to the new server
  3. Updating references in the database that refer to its old location
  4. Changing the values in wp-config.php to fit the new environment

Though far from being rocket science, there is definitely some work involved, especially if you do this process manually. The other option is to call on the help of specialized plugins. The latter can seriously cut down on the time and effort involved.

However, for completion’s sake, we will first review how to duplicate a WordPress website by hand, as it is good practice and it will let you understand all the steps involved. If later you decide to move on to plugins, that’s fine; but I would advise to go through this process at least once.

Making a Copy of Your WordPress Site: The Manual Route

Let’s first have a look at the step-by-step DIY approach.

Step 1: Back up!

Before making any major changes to your site, backing up is always the first step. In case of a snafu (god, I love that word), you will save yourself a headache if you have a saved version to fall back on.

Incidentally, making copies of both your WordPress files and database is also the first step in duplicating it.

First, download your entire WordPress site via FTP. My favorite is FileZilla, but you are welcome to use a client of your choice. Connect to your server, find the WordPress installation, and move it to your hard drive. Be sure to copy hidden files like .htaccess as well (check ‘Server > Force show hidden files’). Now wait.

When the download is done, check for failed file transfers to ensure that your entire site was copied.

Now it’s your database’s turn. Depending on your provider, you will be using phpMyAdmin or some other database maintenance tool for this step.

Don’t worry if your host offers a different tool, the work involved is generally very similar. Check this detailed guide in the WordPress Codex for different platforms

There are also a bunch of plugins and services out there which can make the database backup process much quicker and more convenient:

Optional: Make Room for the New Site

If your plan is to duplicate your WordPress site in a new location, it’s time to prepare the nest. That means deleting any existing database or files that would take up space for the coming site.

Step 2: Create a Database in the New Location

Now you should have both your files and folders, as well as your database safely on your hard drive. For security’s sake, make a copy of both and save it in a secure location before moving on.

The next step is to create a fresh and empty database for the new environment. This again will most likely happen through phpMyAdmin (as described here) or whichever tool your host provides.

Whatever you use, it is important that you end up with the following:

  • The name of an empty database
  • A database user with all privileges
  • The database user password

Make sure you write these down somewhere so you don’t forget. You will need them soon!

Step 3: Upload/Import Database

In the new database we will now restore the one from the website we are attempting to duplicate. For this, access the currently empty database and find the ‘import’ section.

Browse to the SQL file on your computer and start the import. Now get a cup of coffee, this might take a while. You can move on to step four after the process has been successfully completed.

Step 4: Edit wp-config.php

Now that we have the MySQL database in place, we want to make sure our WordPress installation will make nice with it after uploaded. For that we are going to update the information in the wp-config.php of the old site.

Find the file in the copy of your WordPress site and open it with a text editor (my weapon of choice being Notepad++). You are looking for the following strings:

  • define(‘DB_NAME’, ‘database_name_here’);
  • define(‘DB_USER’, ‘username_here’);
  • define(‘DB_PASSWORD’, ‘password_here’);

Change the information to reflect your new environment. Depending on the provider, you might also have to make edits to the hostname (define(‘DB_HOST’, ‘localhost’);) but in many cases leaving it as ‘localhost’ works just fine.

Save and close.  Be aware that you can also do this after uploading your files, however, I find it more convenient to do beforehand.

Step 5: Upload Data

Now we will return to our crafty FTP client, only this time everything is going the other direction. Connect to the new server, drag the files from your local drive to the new location, and lean back. Depending on the size of your site, this will take a few minutes. Maybe it’s time for another coffee?

Step 6: Edit Database

In theory, the duplicated WordPress site should now be able to communicate with the database of its new home. However, the copied database is still full of references to the site’s old location. Time to change that.

My favorite way to achieve this is the handy Search/Replace script. All you need to do is upload it to your new server, access the script via the browser bar (e.g. http://www.yoursite.com/searchreplacedb2.php), and follow the instructions on screen. Don’t forget to delete the file afterwards!

Should you not feel comfortable with this solution and you can access the WordPress dashboard, there are plugins that can help you update the URLs:

If you mess up here, things will break. However, don’t worry too much, you still have everything backed up (Right?).

Step 7: Configure DNS Settings

If everything went well, your new website should now be working properly. As a last step, and if you haven’t done so already, make sure your domain is pointing to the right location so that your site will actually show up. Otherwise all the hard work would be for nothing.

Step 8: Done!

Well done, you have now successfully duplicated your WordPress website. In most cases the aforementioned process will roughly stay the same. Copy files and database to the new location, edit wp-config.php to reflect the changed environment, and change links in the database to the new url. Not too complicated.

However, I will be the first to admit that this is a rather lengthy process, even (or especially) if you have done it a couple of times. If you are asking yourself now if there is some way to speed it up, you’re in luck. There is.

How to Duplicate a WordPress Website: The Plugin Route

Since not everyone wants to go through this every single time they have to move a site somewhere, a few nice people have set out to make life easier for all of us. Below, you’ll find a list of free and premium plugins which are more than happy to do the heavy lifting for you.

1. Duplicator

Duplicator

This plugin aims to let you copy and redeploy a WordPress site with minimal work. With just a few clicks Duplicator will create an archive file containing your files, folders, and database and set up an installer file.

Transfer both files to the new location of your site and access the installer via browser. This will start the redeployment. It’s as easy as installing software on your computer and will even change references in your database to the new location.

No wonder Duplicator comes well recommended with more than 400,000 active installs and a 4.9 out of 5 star rating.

2. UpdraftPlus

UpDraftPlus

This plugin is equally favored by the WordPress community. It has a 4.8 out of 5 rating with the same number of users as Duplicator. UpdraftPlus is originally a backup solution, however, its premium version (or a regular version with the Migrator addon) can also be used to duplicate WordPress and set it up in a new location.

This plugin works very differently, though. You have to make a fresh install of WordPress and set up UpdraftPlus (plus addon) in the new location before being able to import your old site. Consequently, there are several more steps involved than in other previous solution.

3. All-in-One WP Migration

All-in-One WP Migration

Export and import your WordPress data directly from the WordPress backend. All-in-One WP Migration lets you exclude the parts of your site you don’t care about moving (such as post revisions and spam comments) and automatically changes database references to the new location without you having to lift a finger.

Again, you will need WordPress and the plugin already in place before importing your old data; yet, a solid 4.8 star rating says that this doesn’t deter too many users.

4. WP Migrate DB Pro

WP Migrate DB ProThe first premium-only plugin on the list comes with a lot of endorsements from big names in the WordPress ecosystem; and for good reason. WP Migrate DB Pro is a dream to work with.

The plugin allows you to push or pull local or live databases between two connected sites directly from the WordPress backend. No more downloading or uploading files manually. Just hit a button and the rest happens automatically.

However, comfort of this kind comes with a price. Starting at $90 for a personal license, WP Migrate Pro is not cheap. The Developer license (which is probably a more sensible investment), will set you back $199. Yet, if you are a WordPress professional, it’s definitely an investment worth considering.

5. BackupBuddy

BackupBuddy

BackupBuddy is another premium solution for duplicating your WordPress site. Since it is made by iThemes, a plugin maker of good reputation, you can expect high quality and great support.

This plugin has the ability to create a copy of your site in a remote location. That means all you need is a database and BackupBuddy will be able to set up a functioning clone of your site on any FTP server, complete with changed database references and all. Here is a video, in case you don’t understand what I’m talking about.

As I mentioned, this plugin is premium only. Pricing starts at $80 for a year. Well worth checking out.

Cloning WordPress in a Nutshell

Learning how to duplicate a WordPress website is an important step in the process becoming a professional WordPress user. When working with the content management system on a regular basis, it is one of the things you will have to do more often than you thought possible.

However, that doesn’t mean you have to go through the lengthy manual process. A handful of plugin solutions out there, ranging from completely free to premium, aim to make this cumbersome undertaking much quicker and more convenient.

How do you duplicate your WordPress sites and move them to a new location? Share any tips and tools you might have in the comments. Pretty please!

Nick Schäferhoff

Nick Schäferhoff is an entrepreneur, online marketer, and professional blogger from Germany. He found WordPress when he needed a website for his first business venture and instantly fell in love. When not building websites, creating content or helping his clients improve their online business, he can most often be found at the gym, the dojo or traveling to other countries with his fiancé. If you want to get in touch he would love to hear from you through his website.

The post How to Duplicate a WordPress Website appeared first on Torque.

Share This