The precept that ‘change is a constant’ holds to folks running a business website. Consumers anticipate a user-friendly, up-to-date site, so alterations are second nature. Applying these changes to your live site might be detrimental, however, due to downtime or unavailability. It may even tarnish your reputation or result in spending money on fixes. That’s where a staging website comes in handy.
The goal is to steadily improve your site to meet customer needs while keeping your money and reputation at hand. Well, setting up a staging site is the best way to go at it.
What is a Staging Website?
To put simply, a staging website is a copy of your existing website. It exists as a secure environment to implement and test changes before they reach the live version.
Staging sites started with developers testing significant changes to fix any error that may occur. Thanks to the evolution of workflow, they would apply those changes to live sites only when they are 100% error-free.
Why Do You Need a Staging Website?
Yes, you do! Creating a staging environment is a foolproof way to fix bugs and solve problems before they reach your visitors. If your website contains sensitive information, a staging site is moreso necessary for testing.
Devs accommodate new changes using a staging environment until every bit is perfect and ready for live-action.
The sites also double as an ideal area to master WordPress as the workflow of updating themes and plugins data gets improved. You could wrap your head around new plugins, themes, and many other functions. Besides, a staging site will prevent downtime from non-functioning plugins and lacking themes.
Best Ways to Create a WordPress Staging Website
As you may know, WordPress has no rule of thumb. Notwithstanding, while there are multiple ways to set up a staging environment on WP, the three methods below were carefully chosen because of their reliability.
1. Using a WP Plugin to Setup a Staging Site
If you’re hoping to go about it in the most natural way possible, plugins are the way to go. Below is how to correctly set up your staging website using a WP staging plugin.
Before you move any further, we strongly advise you back up your website. Better safe than sorry.
i) Create a new staging website
Download the WP Staging plugin and navigate to the plugin tab on your WordPress dashboard to install and activate it. After successful installation, tap the “CREATE NEW STAGING SITE” button available on the WP Staging tab.
Then input the preferred name of your staging site and click on “START CLONING.”
After successful cloning (often takes a few minutes but depends on the size of your site), the URL of your staging site will be presented. To add a database or folder later on, use the Update option available with the free version of WP Staging.
ii) Push changes to the live site
The pro version of this plugin features an option to push changes with a single click. With the free version, however, you can only push changes manually (which is further explained below).
2. Setting Up a Staging Site on WP Manually
For one reason or the other, the plugin approach is not everyone’s cup of tea. You may be skeptical towards plugins or fear that one may present security issues. Manual creation offers some flexibility, and yes, you’re in full control.
First, keep in mind that the staging site will be established on a subdomain. Why? Because it offers a better workflow of testing and modifying your website compared to the local server (due to its diverse hardware environments).
Before we move on to the step-by-step guide, ensure you have a full backup of your live site. Here we go.
i) Create a new staging site
Access your cPanel, navigate to the section labeled Domains, and go to the Subdomains page.
Choose the name of your subdomain—something along the lines of demo, copy, staging, or duplicate.
Now, navigate to the File Manager.
From the manager, access the subdomain folder in the root folder of your site. Then copy the web content in the root and paste to the subdomain directory.
Navigate to the Files section and tab the Backup button for an exact copy of the database of your live site.
Pick the database to backup, and wait for it to be downloaded from your local server.
Uploading this data to your staging site is next in line. To do that, reach the section labeled Databases and go to MySQL Databases.
Establish a new database.
Establish a new MySQL user.
Assign the new user to the new staging site.
Here, scroll to the part that says Databases and tab phpMyAdmin to restore the backup you took from the live site.
Proceed to the Import tab, choose the file to upload (which is the new database backup file from the local server), and tap Go.
After the successful operation, proceed to the database and click on wp_options. Your job here is on the right-side panel; change the site and home URLs of the live site to those of the staging site.
You’ve made your way to the final step. You have to make some changes to the wp-config.php file of your duplicate site from the File Manager.
Access the WP panel of your subdomain (in our case: https:/demo.andrew.ga/wp-admin) and proceed to the configuration panel. Go to Reading from the Settings, and check the box to “discourage search engines from indexing this site.”
There you have it. And when it comes to pushing tested changes to your real website, you do that manually as well. You’re sure to face downtime when this happens, in any case.
ii) Push changes to the live site
Back up the specific web content and database of both the live and staging sites. Once done, you’re ready to make new changes effective.Get rid of all web contents from the root folder, excluding the staging folder. Now, move all materials in the staging folder to the root folder of the live site.
Moving on, employ phpMyAdmin to access the wp_options of the database and alter both the site and home URLs we swapped earlier back to those of the live site.
Once done, your site will be in functional operation again, and changes will be active.
3. Using Softaculous to Setup a WP Staging Site
Instead of spending time on installing web apps, Softaculous lets you set up a staging site from WordPress Installation. To use this method, follow the instructions below.
i) Create a new staging site
Open Softaculous App Installer from your cPanel, navigate to the top of the right taskbar and click on All Installations.
There you have the WP installed on your site; now, tab the Creating Staging button.
The next screen entails that you input the database name of your staging site and the directory to keep a copy of your live site. After doing so, tab the Create Staging button, and you have a perfect staging environment.
The All Installations page now features your new site on the list.
ii) Push changes to the live site
The Push to Live button, which is in front of the staging site, comes in handy here.
The corresponding page offers a default option, which means all changes will be pushed from the staging site to the live site. However, an alternative exists.
If you’re not in for the default push, you can also customize the operation. You get to choose the database with the specific web content you wish to bring to your live site.
Once done, the changes will instantly be effective and ready for your customers to enjoy.
Which Method is Best for You?
Employing the use of a plugin is probably the easiest and user-friendliest method, while the manual option is more elaborate and entails some know-how. The latter gives you full, flexible control without a price tag. The former, in contrast, has an asking price to enable full functions and its flexibility may be insufficient.
In a nutshell, each entry on the above list has its pros and cons.
Conclusion
Having read this piece, we hope you’re now sure of what a staging site is and some ways to set one up on WordPress.So, the next step is to pick a method and start reaping the benefits of a staging environment.