Why setup a staging environment for your WordPress site? A staging environment is good for testing new features, code or updates before making it live. It’s never a good idea to make changes on a live website in case something goes wrong. You don’t want the world see you try on new clothes.
What is a staging environment?
A staging environment is an exact clone of your existing website and server settings. These environments can be setup through a plugin, manually on private subdomain, or through your hosting’s one-click staging.
Some hosting companies that provide one-click staging:
Links to their one-click staging guides:
SiteGround’s Staging Tutorial
FlyWheel’s Guide: How do I get started with staging?
If your hosting provider does not have one-click staging then continue reading as I will explain 2 ways to setup your own staging environment. We’ll use some plugins and free software to make things easier.
How to setup a WordPress staging environment through a plugin
The plugin we will be using is “WP Staging – DB & File Duplicator & Migration“
Backup your website first. If you do not have your own backup solution I recommend checking out the plugin *UpdraftPlus. They have a free and pro version.
Install and activate the plugin and proceed to the sites and start tab and click the button that says “Create a New Staging Site”. You will be asked to give your staging site a name.
After you name your site hit the “Start Cloning” button and wait for the process to finish. When finished you will be provided a link to your staging site. Use your website username and password to login. All changes on this version of your website will not affect your live website.
When you are done making your changes you can push them to your live site or manually make the changes.
How to setup a WordPress staging environment through a subdomain
This option is done through your hosting provider’s cPanel or Plesk. You’ll need access to this to setup your subdomain. For this example I am using Plesk via *Websavers hosting.
Create the Subdomain
- In your cPanel or Plesk dashboard click on the “Add Subdomain” button.
- Select the correct parent domain (in my case that is allisonwoaddesigns.ca) and enter a name for your subdomain (example: mystagingenvironment). I also recommend enabling SSL if that is an option.
- Once made it should now show up under your websites and domains tab.
Example: This is the subdomain name-> mystagingenvironment.allisonwoaddesigns.ca
Copy your site to the subdomain
Now let’s install WordPress onto the subdomain. Most hosting companies have a 1-click install of WordPress, which is what we will be using here. For manual installation please follow this guide.
- Select WordPress under your hosting 1-click web apps list and choose the subdomain you just made for the install.
- Continue to fill out the required fields to create your WordPress install. These details will be overwritten later by the clone of your website.
- Now in your new WordPress site install and activate the “All-in-One WP Migration” plugin. You will also need this plugin on your live website to export the files. Proceed to export, download, and import the clone of your website . *To note, there is an import limit on the free version of All-in-One WP Migration, so keep that in mind when it comes to the file size of your website.
- When the import is complete you will be asked to re-login to the site.
- You may also have to update your permalink structure by going to settings > permalinks and select the link structure your live site is under.
Example: mystagingenvironment.allisonwoaddesigns.ca
That’s it you now have a staging environment to play around in. You will have to make your changes again on the live website. I suggest migrating your staging site over to your production one using the All-in-One WP Migration plugin again.
*Make your changes manually for eCommerce sites. This is to avoid overwriting important database information like recent orders.
Alternatively you can use Plesk’s cloning to move your website to your subdomain. *Websavers has a great guide on that here
How to keep your WordPress staging environment private
Now that you have your subdomain and clone of your website ready to go you want to keep it private. This step is important to ensure your cloned site is not indexed by Google and you won’t be penalized for having duplicated content on the web. Let’s make your subdomain private so that doesn’t happen.
- To password protect your directory select “Password-Protected Directories” which is found on the dashboard of your cPanel or Plesk. Make sure to choose the one under your subdomain.
- Select “Add Protected Directory” and put in the name of the subdomain you made. In my above example the name would be “mystagingenvironment”. Your subdomain is now private and Google will no longer be able to index the clone of your website.
Alternatively you can go to your WordPress Dashboard > Site Settings > Reading and under Search Engine Visibility check the box that says “Discourage search engines from indexing this site”. Keep in mind that it’s up to the search engine to honour this request.
I hope this guide has helped you create your first staging environment. You can now test website changes and updates without worrying about something going wrong. Best to try on those new clothes while the world isn’t watching.
If you are in need of website technical support my WordPress maintenance plans include setting up a staging site for free.
WordPress Maintenance Plans
Save time, effort and frustration by leaving
your WordPress Maintenance to a pro.