In Hosting Control Panels, Hosting Guides, Web Applications

How to duplicate a domain with Plesk

Graham Posted by

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.

First of all, you’ll need to create webspace to duplicate to, so 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 type of application(s) your site contains.

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

Copy_1

2) Browse to your source domain in your 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”.

Copy_3

3) You can then select the Website Copying tool.

Copy_4

4) 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 dropdown menu. You’ll also need to ensure that the option for “Keep existing files on the destination site” is selected before you click “OK”.

Copy_5

5) 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.

Copy_6

6) You’ll then need to select Webadmin to open up PHPmyadmin.

Copy_7

You may notice the “Copy” button in the previous screenshot 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.

7) 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”.

Copy_8

8) The next screen 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”.

Copy_9

9) 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.

Copy_10

10) 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.

Copy_11

11)  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”.

Copy_12

12) 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.

Copy_13

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

Copy_14

14) Within PHPmyadmin, click “Import”.

Copy_15

15) Select  “Browse…” to find the file on your local machine.

Copy_16

16) When you’re ready to import the .sql file, click on “Go”.

Copy_17

17) You should receive a successful import message, for example:

Copy_18

18) 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 sites you’ll need to edit your local.xml file at httpdocs/app/ . This example is a WordPress site, so we’ll need to edit the wp-config.php file within the httpdocs directory. In the screenshot below I’ve used the Files tab within Plesk to browse to wp-config.php and edit it.

Copy_19

19) If the site you’re duplicating contains several databases, then you’ll have to repeat the above steps (step 6 onwards) accordingly.

20) 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.

21) 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.)

22) 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.  In the following screenshot, we’ve switched to a separate Magento domain to illustrate this.

Copy_20

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

Copy_21

Graham

Author Graham

More posts by Graham

Talk with one of our hosting experts today


Or call 0800 033 7074