How to stop staging site from being indexed and listed

How to Stop a Staging Site From Being Listed in Google

Marvin Russell
Latest posts by Marvin Russell (see all)

Ever have this problem? Your staging site accidentally gets listed in Google’s search results. This is very bad for many reasons. The first reason is the fear of being penalized for duplicate content once the production site goes live. Second, it’s really embarrassing when the client Googles themselves and sees the staging site in the results. Generally, the staging server should only be viewed by the developers and the client. Unfortunately, that doesn’t always happen because the staging site wasn’t properly blocking Google, resulting in the site being listed in Google.

Indexed vs Listed

This is the first common mistake. Many people think blocking Google from indexing your site means you won’t be listed in their search results. So, they end up using robots.txt to block Google from indexing the staging site. That is very wrong. Here’s why:

Being indexed means that your site or web pages have been downloaded and added to a server. That’s all. Being listed means that Google is displaying a link to your site or page in their search results. So, blocking Google from indexing your site doesn’t mean they still won’t list your site in their search results. It just means they won’t keep a copy of it on their server.

Here’s how to stop Google from listing and indexing your staging site.

Step 1: robots.txt

You still want to try and block Google from indexing your site. It does help. But it’s not the answer; hence, step two.  If you don’t know how to stop Google from indexing your site in robots.txt, just add this to a robots.txt file, and place it in the root folder of your website.

In the robots.txt file simply add these two lines:

User-agent: *
Disallow: /

Step 2: .htaccess login

The second step and the most effective way to stop your staging site from being listed in Google’s search results is to require a username and password to enter the site using .htaccess. This will stop Google from accessing and listing your staging site in their search results. Learn more from Google

Create a .htaccess login is fairly simple. In fact, there are a few free tools that will do it for you:


That’s all there is to it. If you follow both steps you won’t get listed in Google’s search results. Both steps shouldn’t take you more than 5 minutes to complete. Oh, be sure to remember one more important thing: don’t forget to give your client the username and password to the staging site.