Site icon Freelance Web Developer, Web Designer Mumbai India

Copy WordPress Website to a new Domain on Different Server using cPanel

In this article I will explain how to copy a WordPress website to a new domain on different server using cPanel.

Copying WordPress website is simple and easy. Please follow the below steps.

Let’s assume we are copying the WordPress site from dominA.com to domainB.com

Step 1

Login to cPanel, click on file manager and go to public_html

Select all files and directs except .cgi-bin and log files.

Right click and archive. Note the archived file name for future reference. Let’s assume wp-admin.zip is the archived file name.

Make sure http://domainA.com/wp-admin.zip is downloadable.

Step 2

Go to phpMyAdmin select the database and export.

Step 3

Login to new domain server cPanel and go to public_html

Delete if there are any default files.

Let’s do a simple trick to copy the archived file from domainA.com to domainB.com

Create a file get.php and put below code.

file_put_contents(‘wp-admin.zip’, file_get_contents(‘http://domainA.com/wp-admin.zip’));

On a new tab try to access get.php on new domain.

http://domainB.com/get.php

Success if blank page appears. This should copy the wp-admin.zip file to new server.

Now delete the get.php file.

Extract the wp-admin.zip file and delete the wp-admin.zip file from old and new server.

Step 4

Create a database and a user on new domain server.

Note the Database Name, User Name and Password.

Add the user to the database with appropriate permissions given.

Go to phpMyAdmin and select the newly created database.

Click on import tab and import the earlier exported sql file from current server.

Select wp_options table and change siteurl and home option URL to http://domainB.com

Step 5

Go to file manager and public_html.

Edit the wp-config.php and replace the Database name, User name and Password.

On a new tab open domainB.com/wp-admin and login with old user login details.

Navigate to Settings => Permalinks and click on “Save Changes”.

Step 6

Install the plugin Find and Replace All using plugin installer and activate.

Navigate to “Find Replace All” settings page.

Enter Find String “domainA.com” and enter Replace with String “domainB.com” and click on “Replace Now” button.

Now all the hard coded hyperlinks and image sources are replaced with the new domain link.

So you have successfully copied WordPress site to new domain. This is the manual method and most reliable.

Hope this helps.

Exit mobile version