A staging website is the perfect environment to test updates, themes and plugins before implementing them on your live site. In this article we’ll explain what a staging site is and how to create a WordPress staging website.
What is a Staging Website?
A staging site is basically a copy of your live website where you can test changes and updates without the risk of downtime on your live site if there are problems. A staging site is not visible to the public and changes you make won’t affect your live site.
How to Set Up a WordPress Staging Website
There are various ways to set up a staging website but the method you use may depend on your hosting plan and your technical ability.
Create a Staging Site Through Your Web Hosting Provider
If you have a managed WordPress hosting plan, the chances are your web host has a staging option available. Website hosting companies usually have their own specific instructions for creating a staging website so it’s a good idea to reach out to your host if you need help.
Manually Create a WordPress Staging Website
If you have a normal shared hosting plan you probably won’t have access to the staging option mentioned above. You can however still create a staging site although it requires a little more work. Here’s how to create a staging website in a subdomain.
1. Create a Subdomain with cPanel
- Log into your hosting account cPanel and scroll down to Domains. Click on Subdomains.
- In the subdomains screen, enter the name of the subdomain you want to create – we’ve called it “staging”.
- Click Create and you’ll have a new subdomain for your staging website.
2. Install WordPress in the New Staging Subdomain
You can easily install WordPress with the Softaculous Apps Installer from your cPanel account. Scroll down to the Softaculous Apps Installer section and click on WordPress.
- In the WordPress interface, click Install Now.
- In the WordPress installation screen, select the new subdomain we created.
- Complete the rest of the setup form to complete the installation process.
Create Your WordPress Staging Website
At this point we have a brand new WordPress installation in our staging domain. If you go to your staging website now it will only be a default WordPress installation with no content.
The next step is to make a copy of our live website and replace the default site in the staging subdomain with the copy. We’re going to use the All-in-One WP Migration plugin to do this.
Step 1. Install All-in-One WP Migration on the Live Website
- Hover over Plugins in your WordPress dashboard and select Add New.
- In the Plugins screen, search for All-in-One WP Migration with the search bar in the top right hand corner of the screen. When the plugin shows on the page, click Install Now.
The plugin will now be installed on your live website and can be accessed from the main menu.
Step 2. Export Your Live Website
- Click on the All-in-One Migration link in the WordPress dashboard menu. This will bring up the Export Site screen. Click on Export To and select File.
- You’ll need to sit back for a few minutes now while the plugin does it’s thing. Once the export is complete, click on Download and save the file somewhere on your computer where you’ll be able to find it later. When the download is complete you can click Close.
Step 3. Install All-in-One WP Migration on the Staging Website
In order to import the file we have just created, we need to install the All-in-One WP Migration plugin on our staging site. The process for installation on the staging site is the same as we used in Step 1.
Step 4. Import the All-in-One WP Migration File to our Staging Site
To import the the file we created in Step 2, hover over All-in-One WP Migration in the WordPress dashboard and click Import.
- Select the file we saved earlier and click on Proceed at the following prompt.
- You can sit back again while the file is imported. When the import is complete you can click Finish an you should have an exact clone of your live website in the subdomain we created earlier.
Securing Your Staging Site
As the site we’ve created is only for staging purposes, we don’t want it to be accessible to the public. To restrict access and prevent search engines from indexing the staging site, we need to password protect the subdomain.
It’s fairly straight forward to password protect our staging subdomain with cPanel.
Password Protect a Subdomain Using cPanel
- Log into your cPanel and scroll down to the Files section.
- Click on the Directory Privacy icon.
- In the Directory Privacy screen, scroll down and open the public_html folder.
- Find the Staging folder and click Edit.
- Click on the Password protect this directory checkbox.
- Type in a name for the protected directory and click Save.
- You’ll now need to create a user and password to grant access to the protected directory. Write these details down and keep them in a safe place.
- Click Save.
Your staging site should now be protected. If a user attempts to access the staging site through a browser they will now be prompted to enter a username and password.
A Local Alternative to a Staging Site
An alternative to a staging site on a live server is to create a local WordPress installation. This involves setting up a server and installing WordPress on your own computer. You can make a clone of your live website to use on local WordPress installation for creating new content, and testing themes or plugins.
A local installation is not a true staging environment however in that it uses a server you set up on your own computer as opposed to the live server provided by your web host. A local website will also only be accessible from the computer it is set up on.
You should never test changes, themes or plugins on a live website. Always test anything that could possibly break your website in a staging environment. A staging version of your WordPress website will eliminate the risk of downtime on your live site if there are problems with any changes you make.