Last updated: August 6, 2020
How To Build A Staging Website
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
When it's time to tweak your website, you might want to use a test version to perfect your changes before they go live.
The changes you're working on may include a new theme, a new CMS or a major upgrade to an application. You may just need to tweak a script.
Doing this on a live website is a bad idea. It can present an unprofessional image to clients, and you also risk losing your data should you create any serious problems or cause annoying errors.
Setting up a test site is the best solution, although it can be complicated.
Here are four ways to create a test site, including the pros and cons of each.
1. Using a Subfolder For a Test Site
The simplest solution is to create a secondary site in a subfolder of your existing site.
For example: http://www.yourdomain.com/testsite
You can then set up a new database and duplicate the content from your original database.
This method is the easiest and most convenient because there are no DNS changes to make. But it may be confusing. Because the URL for the test and the real site are nearly the same, it's easy to mistake one for another.
When using FTP, it's all too easy to accidentally overwrite your real site.
2. Use a Subdomain For a Test Site
Creating a subdomain is easy. In cPanel, the Subdomains icon leads you to a simple setup screen.
The result will be a subdomain like http://testsite.yourdomain.com
Subdomain URLs tend to be less confusing. They look professional, and they indicate to humans and search engines that the site should be considered separate.
Appearances aside, there are few other benefits. It's slightly less confusing than using a folder, but effectively, a subdomain is just a folder in disguise; when using FTP, you could still accidentally navigate to the wrong folder and overwrite something you didn't mean to erase.
3. Use a New Domain For a Test Site
Using a separate domain is more complicated. Many website owners have unused domains that can be allocated temporarily for testing, but you may need to buy one for the job.
In cPanel, it's easy to set up an Addon Domain with its own FTP account and folder. In WHM, you could simply create a whole new account.
Since the test site is on a completely different domain, you won't be confused. The FTP logins are completely separate, so it's much less likely that you'll make an unfortunate mistake.
If you can spare the setup time (and the potential expense of buying a throwaway domain), this is a good option. Though it's painful to wait for DNS to propagate, it's worthwhile to plan ahead.
4. Using a Local Installation
A local installation is a website that runs on your own computer.
There are virtually no security risks with this approach. Your site is completely private; you don't even need to be online to work on it.
There's no way it can introduce vulnerabilities to your server, and you can't overwrite files on main site by accident.
Files will also load instantly and don't cache, which is a benefit.
As for the downsides, you might want to show your test site to a third party, which is difficult; you'll have to share screens via a teleconference call. Even though WAMP and MAMP are easy to set up, they can be intimidating for people who haven't used them before, and you might need extra time to iron out problems.
Still, if you're trying something exceptionally risky, this may be the right solution.
Which Method is Best?
All of the above methods are better than working on your live site. Options 3 and 4 are our favorites. Even if you need to invest time in creating a new setup for testing, you can use it over and over again each time you need to make a significant change.
Image credit: hamilton.lima