A staging server, or a staging website, is a section of a server that is used to test a new version of a website.
When a developer is testing the newer design for the website, he can create a sub-domain and test the new website design there. Not place it directly on the live site.
Generally, the most used way to block Google from crawling and indexing a staging website was to create a robots.txt file.
Google’s John Mueller offered the perfect solutions.
Google’s John Mueller says that the smart way to stop Google from crawling and indexing the staging website was to block the web pages with authentication.
Here is the answer John Mueller gave:
“There are multiple ways… people do it in multiple ways. I think that the important part is that you don’t link to it. Because if we don’t find it then we can’t crawl it. But sometimes that still happens. “
John’s is giving a reference to using Robot.txt to block crawling of the web page. If Google find a link to a blocked page, Google will crawl the URL.
Here is the better way John recommended to block both crawling and indexing of a testing server.
“Ideally, what you would want to do is provide some kind of server side authentication on the server so that normal users when they go there they would get blocked from being able to see the content; that would include GoogleBot.
And you can do that on an IP address basis, you can do it with a cookie, you can do it with normal authentication on the server.
Anything where you have to prove that you’re the right person and you can actually look at that content.
I think that’s generally the best approach for staging servers…”
What he want to say is that by using a password protected solution you will exclude the possibility of making a mistake on your live site.
It is the more smarter way to use authentication to block Google and others from seeing the staging website.
There are many ways to create a password protected staging website. On a dedicated server, you can use your control panel to create a password protected sub-domain.
While if you are using WordPress and on a shared hosting, you can use an external staging server like WP StageCoach or if you don’t want to pay you can use a plugin like WP Staging.
I agree with the advice of John Mueller. It’s a smart way to stage a website behind a password protected directory or sub-domain.