
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.
To do this, your computer must be running web server software: WAMP for Windows or MAMP for Mac. Both include everything you need: Apache, MySQL and PHP.
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
Dean Williams
February 16, 2015
I have found Migration Magic is perfect for managing a test environment for any PHP site, check it out:
http://migrationmagic.com
Howie
May 26, 2015
Hi,
I am looking to build out a site for someone and believe I am leaning towards setting it up on a sub-domain. My question is; how can I avoid actually publishing the content and potentially being picked up as duplicate content when the live site is ready to be officially launched live? Any help is greatly appreciated, thank you!
Toni
June 2, 2015
You can use a noindex tag:
https://support.google.com/webmasters/answer/93710?hl=en
But, better yet — you could make the directory (that the sub domain is pointed to) password-protected using .htaccess.
cPanel makes this easy, but a tutorial on finding how to do yourself with .htaccess should not be much trouble. Good luck!
ssk
June 28, 2018
With options 1, 2, and 3, if you don’t take preventative steps, wouldn’t you run the risk of the site being indexed and crawled by Google etc. and coming up in search results?
Frank Moraes
July 2, 2018
This is an excellent question for reasons that I don’t want to get into. But Google does seem to be able to find pages that you wouldn’t think. But you can prevent them by password protecting your site (it’s trivial in cPanel).
Antony
April 17, 2019
Hi
If I update a current site with new content and theme in a sub domain or subfolder, how do I transfer this to the actual .com domain after changes have been made?
Many thanks
Tylen
February 13, 2020
get rid of your older database, then duplicate your updated database content into it.
Abhinesh Nangla
November 10, 2019
i feel the second method be preferred then what about the url’s? means how these should be kept if i am moving a live site files and database to a testing folder and also for its vice-versa i.e when moving it from testing environment to live location?