How to Create a WordPress Staging Site

WordPress, although the most popular blogging software with thousands of users, somehow fails to be the most reliable website builder. Nowadays, reliability is something that goes along with any type of product development. Have you ever wondered if a certain update or change would shut down an entire website or make it look like it had never been up in the first place? Staging websites can be a very useful way to avoid such inconveniences and make the user experience of your website visitors seamless.

If you are still unsure whether or not you need a staging website, check the reasons below:
  • It gives you the ability to test all types of changes before pushing them to your main website or going live.
  • It reduces the amount of time of your website is blocked to visitors while in “Maintenance mode” because deploying the changes you have already tested takes less time.
  • The chances of implementing an irreversible change are reduced to a minimum when you test before switching content to live pages.
  • The aforementioned point results in your website’s higher SEO ranking and reputation while keeping your visitors satisfied.

Now that you know the value of staging a website before production, let’s look at how this task can be accomplished.

NOTE: This guide is not applicable to WordPress websites built on Managed WordPress Hosting.





Before you can create a staging version of your website, you need to create the main website. We recommend installing it via the Softaculous tool as it gives you additional tools for website management and simplifies staging website creation.



Apart from other tools, Softaculous provides the most effective way to stage a website. However, this requires your website be installed via Softaculous and that it is located in the original hosting account. If you are unsure whether this is your case, you can check if your website is present in cPanel >> Softaculous Apps Installer >> All Installations section. For testing, we use the nctest.info website:

A screenshot of the Softaculous dashboard inside cPanel

If your website was created using Softaculous, you can proceed with the staging creation as described in this guide.




Below, you will find information about staging website creation using 3 different plugins. You can use any other plugins as all of them should work in a similar way.




1. Install the WP Staging plugin as described here.
2. On the left panel click WP Staging >> Sites / Start:

An example of the staging options inside the WordPress dashboard

3. Click Create New Staging Site:


4. Enter your Staging Site Name and click Start Cloning:


PLEASE NOTE: If you do not enter the name, a random digit value will be assigned instead.

5. It may take a few minutes for this process to finish. Once ready, make sure to read the notes below and click Open staging site to proceed to the login page. Your credentials are the same as that of the main website:


The only disadvantage of this plugin is that you cannot push the changes to the main websites with a free version, so the staging website is just for testing plugins/themes before applying the changes on the main one. The best scenario from using this plugin is to create a new staging environment each time you wish to test changes because testing changes on an old staging website may prove irrelevant.




1. Install the All-in-One WP Migration plugin as described here.
2. On the left panel click All-in-One WP Migration >> Export:

Green arrows point to All in One Migration options inside the WordPress dashboard

3. Modify the file you are going to export per your liking using the Advanced options drop-down menu:


4. Click Export To >> File:


5. Click Download [domain.com] to export the file.
6. Install a fresh WordPress on a subdomain (e.g., staging.nctest.info) or in a subdirectory (e.g., nctest.info/staging).
7. Log in to the WordPress Dashboard of the staging website, install the All-in-One WP Migration plugin once again and go to the Import tab:


8. Click Import From >> File and choose the file you’ve previously downloaded.


9. Read the warning carefully and click Proceed to continue.
10. If your import is successful, you should see the following message:


Congrats! Your staging website is now ready.




1. Install the Duplicator plugin as described here.
2. Navigate to Duplicator >> Packages:


3. Click Create New on the upper right corner.
4. Enter the desired name or use a generated one. Leave other values untouched and click Next:



5. Check the notices if there are any. Having made sure that you understand the consequences, select the confirmation checkmark and click Build:



6. Click One-Click Download to download an archive with the website data and the installer file.

PLEASE NOTE: You may need to use the Installer and Archive buttons to download files separately as some browsers block simultaneous downloads.

7. Create a subdomain for your staging website, remembering the document root, with the help of this guide. Alternatively, you can create a subdirectory under your domain’s document root.
8. Upload the previously-downloaded files to the document root of your subdomain or a subdirectory (e.g., nctest.info/staging).
9. Create a database for your installation, remembering the following details:
  • Database name
  • Database user
  • Database user password
All related instructions can be found in this guide.

10. Open the Installer in your browser. It will look like staging.domain.com/installer.php if you created a subdomain.
In case you upload the files to a subdirectory, it will look like: domain.com/staging/installer.php.

Don’t forget to replace domain.com with your actual domain. See below:


11. Select the checkmark to confirm the terms and notices and click Next.
12. Enter the details of the database you’ve created on step 9 and click Next.
13. Click Yes in the pop-up window to confirm the details.
14. Enter the title of your website and click Next.
15. Click Site Login to be redirected to the login page. Your login details are the same as for the main website.
16. Go to the document root of your staging website and delete the installer.php file to avoid any security issues.




If you choose not to mess with plugins to make your site even more complex and feel brave enough to go old school, you can manually create a staging website plugin free. Before you proceed, make sure to read the following guides:

Now that you are familiar with the tools you are going to use, proceed with these steps:

1. Find the files of your installation. In case it’s your main hosting domain, you can find them in home/public_html folder.
If it’s an addon domain, you can check its root folder in cPanel >> Addon Domains menu, located in the Document Root column. If it’s a subdomain, you can check it in cPanel >> Subdomains menu in the same column. See below:


2. Select all the files of the installation and copy them to the document root of the desired subdomain. Alternatively, you can create a directory in the document root of your website and copy the files into that folder for your website staging URL to look like domain.com/staging.
3. Open the wp-config.php file of your website using the View or Edit option to find the following line:

/** The name of the database for WordPress */

Just below, you should see the name of your website database. See below:



4. Navigate to cPanel >> PHPMyAdmin and export the database in question.
5. Update the URL of your website to the desired one using this guide.
For example, if we want the URL of our staging area to be nctest.info/staging instead of nctest.info, we update the database, replacing all occurrences of nctest.info with nctest.info/staging.
6.  Create a database for your staging installation, remembering the following details:
  • Database name
  • Database user
  • Database user password
All the related instructions can be found in this guide.

7. Import the .sql file you’ve updated on your computer into the newly-created database via PHPMyAdmin.

PLEASE NOTE: If the database in question exceeds the 50 MB in size, refer to this guide.

8. Using File Manager, navigate to the document root of your staging website to Edit the wp-config.php file. Fill in the lines with the appropriate name, user, and password of the database that has been created and imported before. See below for reference:



That's it!
Updated
Viewed
31015 times

Need help? We're always here for you.

notmyip