Making a duplicate Wordpress site for testing
Many people want to have a duplicate Wordpress site for testing purposes. In order to do this, there are several steps to take to achieve this outcome. This tutorial will outline the steps for making a copy of a Wordpress site for testing.
Copying a Wordpress site from one location to another
- Log into your cpanel
- Create a subdomain. that is used for accessing the testing site. For example testsite.yourdomain.com.
- Go to your File Manager. Make sure that you select Show Hidden Files when you select the directory to be opened.
- Copy your Wordpress Files from your current directory to the document root directory created for your subdomain. The root directory usually is the same name as the subdomain that was created. Also, click in the folder that contains your WordPress installation and 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. Depending on your installation setup, you may need to look for this file in the root of the account. For example, InMotion Hosting normally uses a document root of "public_html." Check this location for the .htaccess file if you did not find one in the original installation location for your WordPress site.
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. Otherwise, there will be duplicates of those folders in the testing site.
- Create a database This will be used to separate the test site from your main site. If you use the same database for the test site, the live site will reflect the changes that are made on the test site. Importing the existing database to the test site database will prevent this.
- Export your current database
- Import your Database to the new database you created.
- Configure the Test Wordpress wp-config.php file for the test site. This needs to be done or the test site will use the main Wordpress site database.
- Change the site URL for the test site - The site URL is stored in the Wordpress database. in order for the site to load as a test site, the site url will need to be changed to the subdomain url. For example http:// testsite.yourdomain.com.
- 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.
This concludes the tutorial for duplicating your Wordpress for testing.
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!
2014-07-06 11:44 pm
Great tutorial! So after the "test site" is complete how do you copy it back over to replace the original site? Do I just follow essentially these same steps again? Thanks!
2014-07-07 3:49 am
I would recommend that you copy all of your WordPress files in the main /public_html directory to a new one such as /wordpress-backup. Then move all the WordPress files from the sub-directory WordPress installation into the /public_html directory.
Once that is complete, you now have the same core WordPress files in your /public_html directory that were in your /public_html/wordpress directory. The wp-config.php file from that sub-directory installation is pointed still at the new database you crated for the copy site as well.
You will then want to change the WordPress address directly in the database, and modify the siteurl and home rows in the wp_options table to read just your main directory instead of the sub-directory address.
That should be all there is to it. You might also find my guide on how to easily move WordPress helpful in the future, especially the 2nd video and steps. In your case of moving from a sub-directory to the main root would get to skip the exporting and importing the database section, as well as modifying your wp-config.php file, as that's not necessary when doing a WordPress move on the same server.
Please let us know if you had any other questions at all.
2014-09-11 5:04 pm
Unfortunately, this did not work for me. Followed instructions carefully and appears as if everything is moved over, but when i go to the new URL (subdomain), I am told the page is unavailable or does not exist. Thoughts?
2014-09-11 5:53 pm
Sorry to hear that you're having problems with duplicating your site. It would help to be able to see your URL or account, so that we can take a look to see what you've done. Instead of us guessing at the problem, please provide us a little more information and we would be happy to look further into the issue for you.