How to Create a Staging Site & Clone WordPress

Congratulations, you’ve decided to create a genuinely independent WordPress staging and development website with WP STAGING.

That is the first step to ensure that none of your site changes will ever break your production website.

Before you create a testing website, please think first if you like to make your staging site available from a subdirectory of your production site or if you want to make it accessible from a subdomain or different domain.

EXAMPLES:

Staging site in a subfolder:
https://domain.com/STAGING

Staging site in a subdomain or another domain:
https://staging.example.com or https://newsite.com

Both variants are possible with WP STAGING | PRO!

Create a Staging Site in a Subfolder

That is the easiest and fastest way to create a testing WordPress website, and it is the default option that is supported even by WP STAGING basic version.

Note: Depending on your WP STAGING version, your user interface may look slightly different.

Go to WP Staging > Staging Sites and click on CREATE NEW STAGING SITE.

Add the name of the staging site and ignore Advanced Settings:

That makes the staging site available from the link https://domain.com/development.

Exclude Plugins and Tables

Under DB Tables and Files, you can include and exclude individual database tables and folders from the cloning process.

For example, that is useful if you have large tables created by web statistic plugins, security plugins, or mailing plugins that contain thousands or even millions of rows of data like IP addresses, login attempts, mailing list subscribers. Excluding those tables will increase the cloning speed tremendously.

If you are unsure, leave the default values and the DB Tables and Files selection untouched.

Advanced Settings (WP STAGING | PRO Only)

This optional section allows you to choose several things like:

  • Custom destination directory
  • Custom destination hostname in a subdomain like dev.example.com
  • Clone into another external database

Clone the production website to another database instead of using the WordPress production site’s default main database or/and choose a custom destination folder instead of using a subfolder within the root of your production website.

If you are still unsure what this means or are pleased with the default destination, you can skip this step. Just leave the default values as they are and click on START CLONING.
In that case, WP STAGING | PRO will create a staging site in a target subfolder of your production site.

For example, if your production website is located in /public_html and you label the staging site development then you must copy the testing website to /public_html/development to make it available.

If you want to specify the Target Directory of your staging site, you need to adjust the Target Hostname as well:

For instance, your production site is located in /public_html and you’ve set the Target Directory to /public_html/wordpress/development, you need to use the Target Hostnamehttps://domain.com/wordpress/development

Clone to a Subdomain, Another Domain, or Host

You can clone the production website to a subdomain or different domain as long as the path to that new (sub)domain is located on the same server, and the live site can access this folder.

Instead of following the steps below, you can use the backup feature of WP STAGING. Watch this video or read this article.
  • Create a (sub)domain, like dev.example.com from within your hosting panel (cPanel or similar).
  • ​Create a new folder on your server and map the new (sub)domain to this directory. That folder must be writable by the PHP and webserver process. (www-data or similar with permissions 755)
  • Open WP STAGING | PRO and click on Create New Staging site.
  • Open WP STAGING advanced settings and add the new target hostname and the directory.

Bonus: If you are not sure if the subdomain points to the correct path, you can use that little trick:

  • Create a text file and name it test.txt.
  • Add some content into that file, such as “test text.” Use a file manager plugin or FTP to do so.
  • Copy that file into the path you think is correct.
  • Open the file from URL example.com/test.txt. If the path is correct, You can see the text “test text” in your browser.

Cloning to a Separate Database

If you do not tell WP STAGING to use a separate database for the cloning process, all database tables will be copied to the main database and prefixed with a string such as wpstg [id] _.
This prefix separates the tables that belong to the production site from those that belong to the staging site.

That prefix makes sure that the staging website is completely independent of the production website. So the WordPress default database object wpdb has no access to the staging website, and the staging website has no access to the production site.

If you still want a little more safety and separation between both sites, you can copy the database tables to another database.

To do so, activate the checkbox Copy Staging Site to Separate Database and enter the input fields’ database credentials. Make sure that you have created that other database in advance. WP STAGING cannot do that for you due to database permission restrictions.

You can usually create a new database from your hosting dashboard (cPanel) from the database section.

When you are done, test the connection by using the Test Database Connection link:

Start Cloning Process

Click on START CLONING and watch WP STAGING creating the clone of your WordPress website automatically:

Depending on the size of your website, this can take a few minutes or a little longer. When you do that, you’ll get the screen as below:

From that page, you can directly open the staging site by clicking on the Open button, and you will also get an explanation that tells you that permalinks on the staging site are disabled due to technical reasons.

Tip: If you use the Apache web server, try to activate the permalinks again on the staging site. That should be working well.

If you like to open your staging site the next time, go to
WP Staging > Staging Sites.

You’ll get there all previously created staging sites.

BTW. You can create as many sites as your web space allows.

More useful links:

 

 

 

Updated on February 24, 2022