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
  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://
  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

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

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!

9,968 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
n/a Points
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?

17,836 Points
2014-09-11 5:53 pm
Hello Sean,

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.

Kindest regards,
Arnel C.
n/a Points
2014-10-02 7:07 am



Warning: define() expects at least 2 parameters, 1 given in /home/content/10/7441410/html/josh/wp-config.php on line 28Warning: Cannot modify header information - headers already sent by (output started at /home/content/10/7441410/html/josh/wp-config.php:28) in /home/content/10/7441410/html/josh/wp-includes/functions.phpon line 2973

Error establishing a database connection

Please help


Thanks in advance.



9,479 Points
2014-10-02 9:39 am
It looks like you made an error when editing your wp-config.php file on like 28. Could you provide exactly what you have on that line?
n/a Points
2014-09-28 8:55 pm

Awesome tutorial. This really helped me out. Thanks!

And Sean, I had the same issue initially. Turns out I copied all the files to the wrong test folder. It's case sensitive, so make sure the folder is public_html/Test not public_html/test or vice versa.

Don't know if that was your issue, but I got hung up because of that. Best of luck!


n/a Points
2014-10-02 4:37 am

It worked for me. How do i acces wp-admin to make the changes i want and keep the live site working

20,281 Points
2014-10-02 9:00 am
Hello Tejas,

If you moved your site to a subfolder, for instance, from to, then the wp-admin URL for the test would be

Kindest Regards,
Scott M
n/a Points
2014-10-06 10:14 pm

great tutorial, although once i'm done setting up my test site and try to log-in I receive the following error. Any ideas?

Fatal error: Cannot redeclare jetpack_is_mobile() (previously declared in /home4/vince06/public_html/wp-content/plugins/jetpack/class.jetpack-user-agent.php:3) in /home4/vince06/public_html/test/wp-content/plugins/jetpack/class.jetpack-user-agent.php on line 59

9,479 Points
2014-10-07 7:52 am
It appears that your site is attempting to load the Jetpack plugin from both your testing environment as well as your main site, on the same site. I recommend checking through your wp-config.php file as well as your database of your testing environment for any old references to your main production site.
n/a Points
2014-10-07 9:48 pm

I searched for my website through my php admin and changed all the websites to the test version within the wp options of my test site. I also went into the config (codex) of my website to see line 59 (assuming that is what its refereing to) and tried removing it, still same error. I just started my website, and have limited coding and web creation knowledge. The test site is I also tried de-activating Jetpack from the main site, still getting the error. Is there something else that i'm doing wrong?


Thanks again for the help, I apologize for my lack of knowledge on the subject matter.

17,836 Points
2014-10-08 9:46 am
Hello Vince,

Sorry to hear you're still having the problem with Jetpack. If you're still seeing that error, then it's most likely because that plugin is still loaded somewhere on that site (or at least a piece of it is). You need to remove it completely in order to clear the error. If you need more information on troubleshooting plugins, check out troubleshooting WordPress plugins. You will need to remove Jetpack from your duplicate install.

If you are a customer of InMotion, we can also look at the files directly, but we need your account info and a little time to work on your web site. I hope this helps you to move forward. Please let us know if you have any further questions or comments.

Arnel C.
n/a Points
2014-10-12 12:10 pm

Hi there, thanks so much for the vid. Pretty easy to follow. My website has the suffusion theme. However, when I go to the test site, a lot of the suffusion styling isn't there - and there are some text widgets missing in the left hand column? Can you please advise? and 

Many thanks,



9,479 Points
2014-10-13 11:29 am
Depending on how your theme is coded, you may have additional hard-coded links in there which can cause issues. To check for this, you may do a full search on your database within PHPMyAdmin by clicking the Search button up top and entering in your domain.
n/a Points
2014-10-27 4:29 am

Great tutorial.

If i create my duplicate website in a subdomain, will my username and password to access wp-admin be the same as the root domain?

I'm afraid that Google will read my test website as duplicate content. How can i prevent Google from reading my test website?



10,332 Points
2014-10-27 8:55 am
Hello Ori,

Thank you for your WordPress question. Yes, your duplicate website will use the same username and password as the original. You can always change WordPress password, and username.

You can stop Search Engines from crawling specific folders, by using a robots.txt file. For example, you could stop them from searching the folders containing your duplicate site.

You could also password protect the folder containing the duplicate site, then it will only be accessible via username and password.

Thank you,
n/a Points
2014-11-09 8:28 pm

Hi All,

THanks for posting this tutorial. It is very helpful and easy to follow.

I almost got it right however I must have meesed sth up because it does not entirely work.


My original site: available under

My test site:


When I enter this URL: I can actually log into it.

However when I want to bring it up: it redirects me to the original

I have now run out of options as to what I am doing wrong.

Any help will be greatly appreciated.




17,836 Points
2014-11-10 3:12 pm

Thanks for the question. If your installation of WordPress was going to a particular path but it's a sub-directory under another website installation, then you need to make sure that none of the applied re-direct rules are applying to your current URL. Re-direct rules are generally found in the .htaccess file. Since you have not provided us any information on your account we cannot check this for you. You can see an example of a re-direct by going to this article. Click on the link for more help on finding and editing the .htaccess file, please.

If you have any further questions or comments, please let us know.

Arnel C.
n/a Points
2014-11-23 2:03 am

thanks for a really good tutorial, very clear instructions. I've followed the instructions and the test site is there but it's not showing the theme installed in the original site. I'm also not sure how to get in to the dashboard on the test site

url is test.************* (original is *************

10,332 Points
2014-11-24 9:53 am
Hello SIri,

Thank you for your question. Please make sure you have completed Step 9, which changes the domain to the new test URL.

This should fix the styling of the site and allow it to resolve at the new test URL. For example: https://test.*************

Then, you would login to the dashboard using the test URL, for example:

Thank you,

Post a Comment

Email Address:
Phone Number:

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

21 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


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:
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!