Skip to content

How to make a test copy of a site

Herr Vigg edited this page Jun 17, 2019 · 1 revision

Whenever you upgrade a site with any new software, it is strongly recommended to make a test-copy of the site, and to try the new software there before deploying it to the main live site. It is also very handy to have a test-copy to troubleshoot a problem, and/or to let support personnel login in order for them to see exactly the same screens as you are seeing, instead of making tons of screenshots and writing a handful of paragraphs explaining how to reproduce your problem. Below are a few tips on how to simplify making a test-copy.

  • Review your hosting provider documentation on how to create a subdomain like test.yourdomain.com. It should not cost any extra money. Alternatively, you may run a test copy from a subfolder of the main site.
  • Review WordPress documentation on how to run WordPress from a different directory in case you decide to do so.
  • Once a placeholder for a test-copy of your site is ready, use plugin Duplicator to copy the content of your site and its database to the new place. Plugin Duplicator has an excellent help documentation.
  • It is a good idea to put the whole test site under a password (using .htaccess), so that it never gets memorized by search engines.
  • You can use the test-copy for your own troubleshooting without a risk to break anything at the main site. It is also safe to give us an admin access to your test site to simplify troubleshooting.
  • You may find many plugins, which help to duplicate a site, besides Duplicator, for example, WP Clone by WP Academy or All-in-One WP Migration. Let us know which one works better for you.

Before plugins like Duplicator existed, we used these manual steps:

  1. Log in to access your database (phpmyadmin)

  2. Select your database (if necessary) – Choose Export

  3. Use standard.

  4. Format = SQL and choose “Start”

  5. Save this file.

  6. On the server where you want the test site make a new empty database.

  7. Then go through phpmyadmin to this new database and select it.

  8. Via the Import button you now import the file that you had just saved.

Then copy all the files from your WP website (with FTP) to the new location on your server. (As an example to folder yoursite.com/test_copy)

  1. You have to change your wp-config.php file with the details of the new database – username – password – etc.

  2. Change your .htaccess file as in example shown below:
    From:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    

    To:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase **/test_copy/**
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . **/test_copy/index.php** [L]
    # END WordPress
    

Set the appropriate folders (uploads) and .htaccess file with chmod in the way you want them (755 is good).

  1. Then copy the file search_and_replace.php (download here) to the root of your WP installation in the folder test_copy.(unzip the downloaded file first)
  2. With the browser you go to:yoursite.com/test_copy/search_and_replace.php
  3. You will see a page that lets you change the necessary data in the database. (Only the website root, change yoursite.com to yoursite.com/test_copy)
  4. Note, this must be done carefully a typo is easily made.
  5. http and www must not be used because some hosts here otherwise deal with it.
  6. What is important for you to do only the necessary change, then the rest goes automatic.
  7. Let search and change it …. if it’s good then that’s all.

** IMPORTANT:** delete then the file search_and_replace.php

Admin access

When troubleshooting runs into a dead end, when you still have a problem and we cannot reproduce it on our servers, sometimes, the only way to continue troubleshooting is to give us an admin access to your site including access to the files and error logs at the server. There is a number of security issues raised this way. In order not to deal with the possible bad consequences, WordPress does not recommend anyone to give an admin access to your private site: [https://codex.wordpress.org/Forum_Welcome#The_Bad_Stuff](https://codex.wordpress.org/Forum_Welcome#The_Bad_Stuff "WordPress "Forum Welcome" page")

Once you understand the risk, you may still proceed with giving us the access, preferably to a test-copy of the site with a separate FTP access to the file system. Many people, who gave us access, were happy afterwards. We, naturally, take an obligation not to use the access given in any way other than helping you. Your private information will never be shared with anyone outside of the team either.

Alternatively, you may make a copy of your site with plugin like Duplicator, and upload it to somewhere like dropbox for us to be able to download it. Plugin WP Clone by WP Academy has a way to store the copy of your site on your server and give us an encrypted link to download it. Use your favorite backup plugin, there are many.

If you decide to give us access or to upload a copy, please use the “Contact Us” form or private message at Dedicated qTranslate Forum to let us know all the relevant details, including links to the all other places where the problem has already been discussed.