If you’ve ever made changes to your WordPress website and found that it caused errors, or worse, took your site offline, then a staging environment can help such problems from happening again. In this post, we’ll look at what staging environments are and how to set one up for your WordPress website.
Contents
What is a staging environment?
Essentially, a staging environment, also known as a sandbox environment, is a space on your hosting account where you can make an exact copy of your website. As it’s only a copy, this means you can safely make changes to it without affecting the actual live site. For instance, you can experiment with coding and CSS changes, try out new themes and plugins, and check that updates are compatible with your current website. Staging environments can also be used to test changes that are designed to speed up or boost the performance of your website.
The most important thing is that regardless of how you upgrade your site, you can make sure that any bugs or issues are removed before making it live. This means you can avoid live errors and downtime that can have a significant impact on your business.
Setting up a staging environment
There are two main ways to create a staging environment. You can create one manually or you could find that your web host provides a built-in staging environment as part of your hosting plan.
Get your WP site firing on all cylinders, read: How to Optimise WordPress Performance on Shared Hosting
Manual setting up
To create a staging environment manually, you will first need somewhere to host the duplicate site. You could purchase a separate domain to do this, but the most cost-effective solution would be to create a subdomain, e.g., staging.mysite.co.uk. To do this, log into your hosting account, navigate to the domain settings section and find the domain you want to clone. You can then create a subdomain for that domain. How you do this may vary depending on the way your hosting account is set up or which control panel you are using.
The next part of the process is to duplicate your live site. Again, there are a couple of options for doing this. The easiest is to use a plugin like Duplicator or WP Staging. These are designed to automate much of the process and will create a complete copy of your site, including your database and all your files. They will then move the copy to your staging environment on the new subdomain.
Without a plugin, the process is a little more complicated. You will need to export a copy of your site’s files and database to your PC and then upload them to the staging environment using your file manager. In addition, you’ll need to configure the wp-config.php file so that it points to the new database and not the old one. Whichever option you choose, once these steps are complete, you will have a staging environment in which you can make changes to your duplicate site.
Go further with WordPress, read: What WordPress Can Do for You in 2024
Setting up with WordPress Hosting
While using plugins makes it easier to manually create a staging environment, some WordPress Hosting plans make it even simpler. At eukhost, for instance, our WordPress Hosting comes with WP Toolkit, an extensive suite of site management tools which includes a built-in staging environment creator.
To create a staging environment for one of your websites, log into your cPanel account, navigate to WP Toolkit and choose the website you want to clone from the list of installations. Following this, expand the entry by clicking on it and then click ‘Clone.’
You will now have the option to create a new subdomain or use one that already exists – however, do not choose the latter if the existing subdomain is in use. WP Toolkit will automatically create a new database for the staging environment, but at this point, you have the option to change the name. Once you are happy with your choices, simply click ‘Start’ and the staging environment will quickly be created for you and will appear in the list of WordPress installations.
The other advantage of using WP Toolkit to create staging environments is that it automatically disables search engine indexing by default. This prevents issues with duplicate content when you have two identical websites.
Just as importantly, WP Toolkit makes it easy to take your finalised changes and transfer them to your live site once you have finished testing them. To do this, go to the list of installations, find the staging subdomain and expand the entry. Following this, click on the ‘Copy Data’ button. You are then presented with a list of options, such as the location you want the data copied to (i.e., your live domain), the data you want to copy and the database tables.
With regards to data, during the time you have spent testing your new site, some of the themes and plugins may have been updated on either of the sites, for this reason, you should choose the ‘Files and Database’ option and select ‘Replace files modified on target.’ Similarly, select ‘All tables’ for the database option. Finally, as WP Toolkit excludes the database tables for pages, posts and users, untick these options if, in the interim, any of these have been updated and you want them transferred to the live site.
Once you are happy with your settings, simply click the ‘Start’ button and your live site will be updated automatically for you. Finally, as search indexing was turned off by default on the staging site, you will now need to reactivate it on the updated live site. Again, this can be done within WP Toolkit.
Learn more about WP Toolkit, read: WordPress Hosting – The Benefits of the WordPress Toolkit
Conclusion
Staging environments are an essential failsafe that enables website owners to test changes to their website in a safe environment without having any effect on their live site. This way, they can ensure that modifications work effectively and will not crash or disrupt the live site. While staging environments can be created manually, WordPress Hosting plans that come with features like WP Toolkit make the process quicker and easier, including when reversing the procedure to update the live site.
For more information about our feature-packed WordPress Hosting plans with WP Toolkit and WP Accelerate, visit our WordPress Hosting page.