• My wordpress site is installed at the root (i.e., everything is under /public_html/).

    I would like to set up a test site (for now a mirror image of the current one). I need to be able to access the test site from any computer, so having it on the web is important.

    The instructions for “Hiding Your WordPress Test Area” (https://codex.www.ads-software.com/Test_Driving_WordPress) suggest putting your test folder at the root (e.g., https://example.com/private), and then adding to it a password protected .htaccess file which references the path.

    So do I just create a folder called “private” at the root and then copy and paste my existing WordPress folders and files to it (along with the new .htaccess file)? Then if I go to https://www.example.com/private I’ll be prompted for my username and password, and after entering both I can work on my test site?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi

    Another approach is to create a subdomain on the domain…
    test.example.com
    and load WP in the root folder of the subdomain. An advantage of this is then you have both installations in a root folder.

    Either way, under Admin /Settings /Privacy, set it to not notify search engines.

    When you move WordPress at all, there are queries you need to run on the database as old full URLs containing the domain and root folder path are hardcoded in the database in many locations. These have to be updated to the new domain.

    Thread Starter foxtrot123

    (@foxtrot123)

    And I guess the same questions still apply:

    > … and load WP in the root folder of the subdomain

    1. How do I “load WP” in the root folder? Do I do a fresh install and copy over certain files from my current site? (and then run the queries on the database?) Or do I copy and paste every folder and file from my current site, and this somehow ‘installs’ WP and duplicates my site (and then run the queries on the database?)

    2. Do I use the .htaccess method to password protect the subdomain?

    Thanks for your help.

    1. How do I “load WP” in the root folder? Do I do a fresh install and copy over certain files from my current site? (and then run the queries on the database?) Or do I copy and paste every folder and file from my current site, and this somehow ‘installs’ WP and duplicates my site (and then run the queries on the database?)

    It sounds like your main site already exists. Easiest will be to copy all the files in the entire WordPress installation. Load a copy of them in the root folder of the subdomain (or folder, if you decide to use a folder instead of a subdomain).

    Then you have to create a copy of the existing database and run a few queries on it, to replace all references to the live site URL to the test site URL.

    Here is an article that summarizes the steps (it leaves out the need to run the queries on the new database)
    https://www.prelovac.com/vladimir/how-to-move-wordpress-site-to-another-server-with-zero-downtime

    Here is an article on how to back up the database
    https://codex.www.ads-software.com/Backing_Up_Your_Database

    Here are the 3 queries that get run on the new database after it’s been created. Change “old-url” to the exact URL of the domain as configured in your live site – see Admin / Settings / General for the details. Change “new-url” to the new domain url. If you don’t know how to work with PHPmyAdmin, the “how to back up your database” article link shows how to get into PHPmyAdmin. You then click on the SQL tab on the horizontal options at the top, and run these queries one at a time by pasting them into the query box. This must be done, to keep permalinks and image URL’s working correctly on the test site.

    UPDATE wp_options SET option_value = replace(option_value, 'https://www.old-url.com', 'https://www.new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    
    UPDATE wp_posts SET guid = replace(guid, 'https://www.old-url.com','https://www.new-url.com');
    
    UPDATE wp_posts SET post_content = replace(post_content, 'https://www.old-url.com', 'https://www.new-url.com');

    2. Do I use the .htaccess method to password protect the subdomain?
    yes, you can do that. If your server uses cPanel there is a cPanel option to password protect a folder. You can use that if its more convenient.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create a test site’ is closed to new replies.