The instructions below will allow you to copy a complete WordPress website, and all files, from one domain to another, within Plesk version 12.5 or higher.
We are assuming that the old domain is called olddomain.com and the new domain is called newdomain.com.
First you purchase and add your new domain to Plesk as you would to add any site. That is a different tutorial, but it involves registering a domain, and pointing the nameservers (at least DNS a records) at your server’s IP address.
First Step – Copy Website Files
- In plesk, go to DOMAINS and open the website you want to copy (olddomain.com)
- Click “Website Copying” in the options, and then select the NEW domain from the list under “Website in Plesk”.
- Click “Delete all destination files” if you want to copy over everything in the “New” domain (which will just be standard stuff which is already there when a domain is installed)
- Click OK at the bottom
This should complete the website FILES copy.
Next Step – Copy the Complete WordPress Database
You also need to copy the database. It is a similar process.
- Open Domains > olddomain.com in Plesk
- Click “Databases” either from the Tab or the box to the right (both point to same screen)
- There should be only one database – click the “Copy” button to reveal copy options
- Give your copy database a name, like copy_olddomaindb or similar
- This will create a copy of the database and place it under the “old” website. We want to move it to the new one’s subscription, so in the databases tab, under your new copy_olddomaindb database, click “move to subscription” and select your new subscription.
- Click “OK”.
Next Step – Connecting newdomain.com’s WordPress to the New (Copied) Database
The final part is to connect up the newdomain.com WordPress website to the new (copied) database; change the URL and website address in the database itself; on your new WordPress website.
- Navigate to the settings on your new domain in Plesk, and click “databases”. You will need to create a new database user to connect to your database.
- Your copy database should show that it has no users. Click that to add a database user, and password, to connect to this database.
- MAKE A NOTE OF THE USER NAME AND PASSWORD IN A NOTEPAD!
You need to update your WordPress config on the new domain and tell it to connect in to your WordPress website’s database.
This file is called wp-config.php and it will sit in the top level of your new website’s files.
- Go to domains > newdomain.com and open File Manager.
- Scroll down to wp-config.php and open that file.
- Click on “Edit in Code Editor” (you could equally use text editor)
- Then you need to update the values within the single quotes under:
Replace the old details with the new ones you just made. Database name is the name you provided above (when you copied the database); username and password are the new user details you just made. If you forgot or did not copy these, you can go back and edit them.
FINAL STEP – Setup the URL and Home in your New Domain Database
There is one final step. You copied the database from a website which lived at olddomain.com. The details stored in the database for that website (and indeed any image files and non-relative links stored within that website), need to be swapped for newdomain.com.
To do this, you can use PHPMyAdmin to first update these details in WordPress database (so you can actually view the website and login!); then install and use a plugin to swap the less important file / image and other locations across the website.
This is the final step.
Updating the WordPress database to the correct newdomain.com URL:
- Go to the new domain in plesk and select the databases screen;
- Click phpmyadmin next to the database in question (the one you copied in earlier!)
- open the wp_options (or someotherprefix_options) table, by clicking on it;
- Under siteurl and home it will say http://oldomain.com – click on edit next to these and change for http://newdomain.com – be sure to get the full URL absolutely right!
- exit / close phpmyadmin
Install a plugin to update URLs saved in the database (for image etc files and any links, so they point to the right domain – this is important!)
- Login to wordpress in the new domain and navigate to http://newdomain.com/wp-admin
- Go to plugins > add new and search for “Velvet Blues Update URLs” – this plugin can update URLs in your site – install and activate this plugin;
- go to the Update URLs page and copy in http://oldomain.com and http://newomain.com into the relevant boxes, select each option you want to update, and hit “Update URLs NOW” to complete this action!
- You should now be finished!
This is the final step, you should now have successfully copied an existing WordPress website, including all files and database, from one Plesk domain to another.
Leave a comment below if this did not work for you.