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

  1. Log into your cpanel
  2. Create a subdomain. that is used for accessing the testing site. For example testsite.yourdomain.com.
  3. Go to your File Manager. Make sure that you select Show Hidden Files when you select the directory to be opened.
  4. 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.

    duplicate-wordpress-site-for-testing-select-all 4.1 Select all the Wordpress files.


    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.

    duplicate-wordpress-site-for-testing-copy-files 4.2 Click Copy at the top right side of the File Manager


    duplicate-wordpress-site-for-testing-click-copy 4.3 Type the path to the Document Root folder for the Sub Domain.


  5. 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.
  6. Export your current database
  7. Import your Database to the new database you created.
  8. 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.
  9. 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.
  10. 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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
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.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
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!

Staff
9,521 Points
2014-07-07 3:49 am
Hello Joey,

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.

- Jacob

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

2 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!