Keep a Staging Site Out of Search
Before You Start
This guide shows you how to keep a staging site out of search results, so test pages never compete with your live site or expose unfinished work. It is for developers, agencies and site owners who run a test copy of a website on a public address. You need access to the staging server or hosting account, the ability to set password protection or response headers, and a clear view of which sitemap the staging copy uses.
Restrict Access First
- Protect the staging site with a password. Use HTTP authentication or an equivalent login on the whole staging address. A crawler that receives a login prompt cannot read the pages, so there is nothing to index.
- Send a noindex header. Add an X-Robots-Tag header with noindex to staging responses as a second layer. This works only while the pages remain crawlable, so do not rely on it alone when password protection is available. The header is explained in the X-Robots-Tag header.
- Keep the address closed. Host the staging copy on a subdomain or address that is not linked from public pages, and avoid sharing its links in public documents.
- Keep the live sitemap off the staging site. Do not copy the live sitemap across, and do not link staging pages from public pages or shared documents.
Handle Pages Already in Search
- Request removal of listed staging URLs. Use the removal tools in Search Console for the affected addresses, which can speed up removal for specific URLs.
- Keep protection in place. Leave the password or noindex in place until the listings have disappeared, so crawlers cannot restore them.
- Check the results. Search for the staging domain and for unique staging text to confirm the listings are disappearing.
Common Mistakes and When to Ask for Help
- Blocking the staging site with robots.txt alone, which stops crawlers reading any noindex tag.
- Copying the live sitemap to the staging site, which points crawlers directly to test pages.
- Leaving the staging site open and assuming search engines will ignore it.
Ask your host or developer for help if you cannot add password protection to the staging address, or if test pages keep appearing after access is restricted. A host can usually set access control at the server level, which is more reliable than page-level settings. See robots.txt versus noindex for why robots rules alone fall short.
Will deleting a staging site remove it from search?
Eventually, if its URLs return errors and no longer exist, search engines drop them. Removal is not immediate, and listings can remain for a while. Requesting removal through a search engine's tools can speed up the process for specific URLs.
Is robots.txt enough to hide a staging site?
No. Robots.txt stops crawlers fetching pages, but it does not stop a URL being listed if other sites link to it. Because crawlers are blocked, they also cannot read a noindex tag, so the result can be a bare listing with no description. Password protection is more reliable.
Should a staging site ever be indexed?
No. A staging site is for internal testing and should not be indexed. If a page must be shared for review, use access controls rather than relying on search engines to ignore it. The live site should always be the version that appears in results.