How to copy my WordPress site into a sub-domain?

How can I create a working copy of my WordPress site into a subdomain and keep the original site.

Add Comment
1 Answer(s)
Best answer

There are few steps than need to be followed in order to copy a WordPress site. All of the actions can be done through cPanel.

– Create the desired sub-domain (in the tutorial, we are using new.cabbagecorp.net). When you are creating it, it will show you the path (document root) to its folder. You will need it later. In this case, we have /public_html/new

– Go to your File Manager. Go to Settings in the top right corner and select Show Hidden Files:
RE: How to copy my WordPress site into a sub-domain?

– Go into the public_html folder and use the “Select all” and “Copy” options to copy your WordPress Files from your current directory to the document root directory created for your sub-domain. In the pop-up widow, you can put in the root directory of the sub-domain. Make sure to copy the .htaccess file. This file needs to reside in the same location where you have copied your WordPress files or at the root of the new location. The .htaccess file may contain important references to your current WordPress installation.
RE: How to copy my WordPress site into a sub-domain?

****Important! When selecting all your WordPress Files, make sure the folders for the subdomains/addon domains, or any other non WordPress folders, are not selected. After selecting all, hold the Ctrl key on the keyboard and click the folders that are not being moved so the are not highlighted blue before copying the files.

– Create a database This will be used to separate the new site from your main site. Make sure you save the database name, user and password as they will be needed later:
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?

– Export your current database through cPanel > phpMyAdmin. If you are not sure which database to export, locate the wp-confic.php file in the File Manager and use the “View” option. In the file is defined the database used by the application. (More on the export – https://www.tmdhosting.com/tutorials/video/phpmyadmin/phpma-export.html)

– Import your Database to the new database you created. (https://www.tmdhosting.com/tutorials/video/phpmyadmin/phpma-import.html)

– Configure the new WordPress wp-config.php file for the test site. This needs to be done or the sub-domain site will use the main WordPress site database. Use the “Edit” option in the File Manager. Make sure the changed file is the one located in the folder of the sub-domain, not the main one
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?

– In phpMyAdmin, change the site URL for the test site – The site URL is stored in the WordPress database (Look for table Options), in order for the site to load as a test site, the site URL will need to be changed to the sub domain URL:
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?
RE: How to copy my WordPress site into a sub-domain?

– Correct image links – Lastly, ensure that image links in your pages and posts are also changed. These are in the database and not connected to the site URL so they will need to be changed separately. Search the database for the original URL and replace it in the results (https://www.tmdhosting.com/tutorials/video/phpmyadmin/phpma-search.html).

This is it. You now have a working copy of the site in a sub-domain.

Geraldine Stevens Answered on March 24, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.