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.

First of all, you’ll need to create webspace to duplicate to, so you need to add a new subscription for your fresh domain to sit under. 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.

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

Browse to your original domain in the Plesk Control Panel and select Manage Hosting. If you can’t see the Website Copying tool from this menu, you’ll need to select Show More.

You can then select the Website Copying tool.

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.

As mentioned above, this tool will only copy your website’s files so following this you’ll need to copy across any associated databases. 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 Webadmin to open up PHPmyadmin.

You may notice the Copy button in the previous menu and wonder why we’re not going to use that. If you select this option, you’ll discover that Plesk only allows you to duplicate your database to a fresh database within the same subscription. Ideally, we want to duplicate the database to a separate subscription for the separate domain – for security reasons we always recommend that each fresh domain is created under a fresh subscription.

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.

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!