Moving a WordPress site is challenging enough, but replacing a live site requires a bit more effort. For this effort, we’ll be using Duplicator Pro – a great plugin that is useful in both backing up or moving a site.
The procedure for overwriting an existing site is very similar to the procedure for moving a site and it’s recommended you are at least familiar with the steps outlined in How To Easily Move A WordPress Site. However, some extra steps are required to ensure you are doing things in a safe manner.
The following procedure explains how to do that and assumes you already have a package of a site you wish to restore.
Step 1.Create a Backup Directory
Because you already have a live site present, it’s good practice to back up the files of the directory before installing a new one. Create a directory on your host and copy the existing site files to the directory.
Step 2. Install an HTML Maintenance Page
Depending on your situation and traffic, you’ll usually want to avoid having visitors experience HTTP errors while your site is being restored. To address this, download an HTML maintenance page and name it ‘index.html’ so anyone who hits your site will be know it’s under maintenance.
This page has a list of free and commercial maintenance pages you can use. Important: These are HTML pages and not WordPress plugins. This is important since you’ll be replacing the existing site thus installing a WordPress plugin isn’t appropriate for this scenario.
Step 3. Remove All Files and Sub-directories
Remove all files and sub-directories related to WordPress in the website directory. If the directory you used to backup the site is in this directory structure do not remove that directory.
Important: Any non-WordPress files and directories should not be deleted.
Step 4. Create a New Database & User (Optional)
You’re going to need a new database rather than reusing the existing one existing because we’re going to need the option of backing out the restore in case of error or other unforeseen event. However, the way you create the database varies. If the host you are restoring to is running cPanel, you can skip this step and use the capability of the installer to create the database from within the installer.
If you aren’t running cPanel or would rather manually create a database, log in to your host panel and create the database and user. If you aren’t sure how to do this, refer to step 5 of How To Easily Move A WordPress Site.
Step 5. Browse to the Installer and Install
At this point, install the site. If you manually created the database and user in step 4 you can simply fill in that information then select Connect and Delete Any Existing data on the new database.
If you didn’t yet create a database and user and are running cPanel, select the cPanel tab of the installer and instruct the installer to create those items.
Important: No matter how you install it it’s important that you install to a new database rather than attempting to overwrite the one the current site is using.
Step 6. Remove the Maintenance Page and You’re Done
Now that the site has been installed you may now delete the maintenance page installed in step 2.
And that’s it – the previous site is gone and the backup has been restored.
Wait! Something Doesn’t Look Right!
In the event that something has gone wrong or doesn’t look right you have the option of either attempting to correct it or restore the site that was in place before you attempted the rollback.
To do that, simply delete all files from the directory, copy the files that were backed up in step 1 and then determine how to resolve the problem.