Clone your WordPress site to a test environment


Clone your WordPress web site

Follow the step by step instructions blow to help you in Clone your WordPress site to a test environment. This setup guide will show you to create a new test website on your existing web hosting account, like mine as an example http://test.joebloggs.com/.   Follow the steps below and replace your website details with the example.

1. Create a Sub Domain – Your Web Hosting Control Panel

In CPanel – Domains SubDomains
subDomain = test
test.joebloogs.com
document root /<Your httdocs or public_html directory>/test
Create
2. Copy Files from Live Environment to Test Environment – Your Web Hosting Control Panel File Manager

Create directory /<Your httdocs or public_html directory>/test
Select all files in /<Your httdocs or public_html directory>/ copy to /<Your httdocs or public_html directory>/test
Copy Files
3. Create a new Database – Your Web Hosting Control Panel Database Section
In Databases CPanel – MySql Database Wizard
New database name jogbloggs_test
Create database users
Create new user and give all privilages

 

4. Export Live Database – Your Web Hosting Control Panel Database Section
In Databases CPanel -PhpMyAdmin
Export quick format SQL
Save file

5. Import Script to Test database – Your Web Hosting Control Panel Database Section SQL Import Tab

6. Change /<Your httdocs or public_html directory>/test/wp-config.php to new Test database details – Your Web Hosting Control Panel File Manager

7. Change Custom Settings in Test Database – Your Web Hosting Control Panel Database Section

Replace your website details with the example and run the following SQL script:-

UPDATE wp_options SET option_value = replace(option_value, ‘http://www.joebloggs.com’, ‘http://test.joebloggs.com‘) WHERE
option_name = ‘home’ OR option_name = ‘siteurl’;

UPDATE wp_posts SET guid = replace(guid, ‘http://www.joebloggs.com’,’http://test.joebloggs.com‘);

UPDATE wp_posts SET post_content = replace(post_content, ‘http://www.joebloggs.com’, ‘http://test.joebloggs.com‘);

UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://www.joebloggs.com’,’http://test.joebloggs.com’);

8. Add new DNS A (Host) Record to your Domain

Host = test.joebloggs.com
Points To = (Your ip address)
TTL 1 Day

Updating the DNS is usually pretty quick, should take no more than 24 to 48 hours. If you use DNS Tracker, Click Here for DNS Tracker this will provide you with the status of the worldwide web database synchronisation.


Published by:  mike    July 7th, 2016    Web WordPress  

Leave a Reply

Your email address will not be published. Required fields are marked *