How to duplicate a website using Plesk

Time to Read: 10 minutes Difficulty Level: Intermediate
Tools Needed: Plesk control panel access Last Updated: 03/12/2018

Introduction

This guide will show you how to copy your domain over to a fresh site. You can use this for the purposes of creating a site for development purposes or just to duplicate content. Alternatively, if you would prefer our Hosting Support team can undertake the work on your behalf for a fee.

The look of Plesk’s panel and it’s options may differ depending on which Plesk license your server has. Below we have outlined how to do this on the two views in Plesk

First of all, you’ll need to create webspace to duplicate to. In this example, we’ll duplicate my polka.shorts site to polka.tee. Please note that the process for duplicating a site will differ slightly depending on which application(s) your site contains.

On a server with 30 Domain license :

Click on Subscriptions in the left-hand sidebar, then Add New Subscription to set your new domain up.

Browse to the original subscription (the source domain) you are wanting to copy by Clicking Subscriptions > Click your domain name > In the Dashboard section, press Website Copying.

On a server with a 10 Domain License:

Within the Websites & Domains tab on the left-hand sidebar, Click on Add Domain.

Browse to your original domain (the source domain). Within the Dashboard section, press Website Copying.

Please note that the website copying tool will only copy over your website’s files. This may be fine if you’re copying a static HTML site but in most cases you’ll need to copy over your site’s database(s) too.

In this section you’ll need to specify the name of the new site you’re duplicating to from the drop-down menu. You’ll also need to ensure that the option for Keep existing files on the destination site is selected before you click OK.

Copying the database

As mentioned above, this tool will only copy your website’s files so following this you’ll need to copy across any associated databases. There is a couple of ways to do this.

1) We’ll use the phpMyAdmin tool to create a copy of my site’s polkas_wp1 database here.

To start off with, browse back to the original domain within Plesk and select the Databases tool.

You’ll then need to select phpMyAdmin to open up phpMyAdmin.

PHP will open as a pop-up window, so you may need to temporarily allow pop-ups, depending on how your web browswer is configured.

Once we’re in PHPmyadmin, we’re going to export our database as a .sql file, so select Export.

The next menu asks us to choose between Quick and Custom. Select Custom here to display the advanced options.

All database tables should already be selected, but if they’re not you’ll need to click Select All.

Scroll down the page. We recommend that you check the box for Disable foreign key checks as this often causes problems when importing the database.

Scroll down to the bottom of the page and select Go to run the export. You’ll then need to select Save File from the pop-up window to save this file on your local machine.

Close the PHPmyadmin window and return to the Plesk Control Panel. You’ll need to browse to your new domain (polka.tee in this example) and select the Databases tool. We need to create an empty database for importing our .SQL file into, so select Add New Database.

From here you can input details for your new database. The following screenshot highlights the fields you need to pay special attention to. You’ll need to keep hold of the Database name, username and password that you specify here. Select OK to create the database.

Now we need to import the .SQL file we created earlier into the blank database. Select Webadmin again to open up PHPmyadmin.

Within PHPmyadmin, click Import. Then Browse… to find the file on your local machine.

When you’re ready to import the .sql file, click on Go.

You should receive a successful import message.

Once again, you’ll need to close down your PHPmyadmin window (or tab!) to return to the Plesk Control Panel. You’ll then need to update the relevant config file for your new site with the relevant credentials for your new database. You can edit the files manually using the Plesk File Manager tool or via FTP if you prefer.


2) Also in the database section, you may notice the Copy button in the menu. If you select this option, this can create a fresh database within the same subscription. You can then use the Move to Subscription or Move to Webspace (30 Domain License and 10 Domain License respectively) to move this to the correct webspace.

3) In Plesk we also create daily-database-backups located in /daily-database-backups, which are backups which created on a daily basis for all your databases in the webspace. These are root owned files. So whilst they can not be used where they are now, they can be moved to into another location or downloaded to be used elsehwere.

For example, for Magento 1 sites you’ll need to edit your local.xml file at httpdocs/app/ . Similarly if you have a Wordpress site, you’ll need to edit the wp-config.php file within the httpdocs directory.

If the site you’re duplicating contains several databases, then you’ll have to repeat the above steps accordingly for each database.

Applications such as Wordpress and Magento will require that you update the base URLs of your site within the new database. Note that this is not required for all databases – some applications won’t define the base URL in the database so you may have to edit this elsewhere.

If there are any hard-coded URLs within your site, you’ll need to update these manually. This is something that you will need to do yourself (unless you’re using WordPress, in which case you can use a Find and Replace script to do this for you.)

Finally, depending upon your site’s application you may need to refresh your site’s cache to ensure that your new site displays correctly. For a Magento site, this can be done from within the admin area if you can access it. Alternatively, you can use the Files tab within Plesk to browse to httpdocs/var and rename the /cache directory. You’ll need to hover over the cache directory and click the downward arrow next to it.

From here you can select Rename and enter a new name (any name!) for the cache directory. And that’s it – you’re done!