How to Fix an Indexed Staging Site in Google and Bing
An indexed staging site means copies of your pages on hosts like staging.example.com or dev.example.com appear in Google or Bing results. By the end of this guide you will have found every exposed test hostname, put it behind a password and a noindex header, and requested its removal from search results.

Why it matters
Indexed staging copies compete with your live pages as duplicate content and can outrank them, splitting links and sending visitors to unfinished pages, broken checkouts or test prices. AI search tools that pull from the index can quote outdated staging copy as fact. Staging environments also often run debug modes, test accounts or unpatched plugins, so a publicly listed staging URL gives attackers an easy target.
What you need
Step-by-step fix
List every staging and dev hostname
Find what is actually indexed before changing anything. In Google and Bing, run these searches and note every non-production host:
site:example.com -site:www.example.comsite:staging.example.com,site:dev.example.com,site:test.example.cominurl:staging site:example.com
Also check platform hosts such as *.vercel.app, *.netlify.app, *.webflow.io, *.wpengine.com or *.kinsta.cloud by searching for your brand name plus that domain. To catch hosts search hasn't shown yet, look up your domain on crt.sh, which lists every subdomain that has been issued an SSL certificate.
site:example.com -site:www.example.com site:staging.example.com "Example Co" site:vercel.app "Example Co" site:netlify.app
Put staging behind HTTP authentication
Password protection is the most reliable fix. Crawlers get a 401 Unauthorized, can't read any content, and drop the URLs from the index over time. Create a password file, then enable basic auth on the staging server block or virtual host only.
Never apply it to production.
# Create the password file (Apache utils / htpasswd)
sudo htpasswd -c /etc/nginx/.htpasswd-staging exampleco
# Nginx: inside the server block for staging.example.com
server {
server_name staging.example.com;
auth_basic "Example Co staging";
auth_basic_user_file /etc/nginx/.htpasswd-staging;
# ...rest of config
}Add an X-Robots-Tag noindex header as a backup
Passwords sometimes get turned off for client demos or QA tools. A server-level X-Robots-Tag: noindex, nofollow header keeps staging out of the index even when it is briefly public. It also covers PDFs and images, which a meta tag cannot do.
Use always in Nginx so the header is sent on 401 and error responses too.
# Nginx (staging server block) add_header X-Robots-Tag "noindex, nofollow" always; # Apache (.htaccess or staging vhost, needs mod_headers) Header always set X-Robots-Tag "noindex, nofollow" AuthType Basic AuthName "Example Co staging" AuthUserFile /etc/apache2/.htpasswd-staging Require valid-user
Remove robots.txt Disallow rules on staging
txt does not remove indexed pages. txt". Let crawlers reach staging and get the 401/noindex response until the URLs drop out.
Add a Disallow later only if you want to.
# staging.example.com/robots.txt — while de-indexing User-agent: * Disallow:
Request removal in Google and Bing
com in Google Search Console using a DNS TXT record. It covers every subdomain. com/`.
Repeat for the http:// version and each staging host. In Bing Webmaster Tools, go to Configuration → Block URLs and block the staging directory, or use the Content Removal Tool.
https://staging.example.com/ http://staging.example.com/ https://dev.example.com/
Close the leaks that exposed staging
Staging usually gets indexed because something links to it. Check production for:
- Absolute links, images or canonical tags pointing at staging hosts
- Sitemaps that list staging URLs
- Hreflang tags that reference staging
Also check that staging doesn't publish a sitemap or ping search engines. Search the production database or codebase for the staging hostname and replace it.
grep -rn "staging.example.com" ./src ./templates # WordPress database (WP-CLI) wp search-replace 'https://staging.example.com' 'https://www.example.com' --dry-run
Confirm the response and track de-indexing
Check the staging response headers from outside your network, and confirm production still returns 200 with no noindex. Then use URL Inspection in Search Console on a staging URL: once recrawled, it should report "Excluded by 'noindex' tag" or a 401 error. Repeat the site: searches from step 1 weekly until they return nothing.
curl -sI https://staging.example.com/ | grep -iE "HTTP/|x-robots-tag|www-authenticate" # Expect: HTTP/2 401, www-authenticate: Basic, x-robots-tag: noindex, nofollow curl -sI https://www.example.com/ | grep -iE "HTTP/|x-robots-tag" # Expect: HTTP/2 200 and no noindex
Platform-specific notes
WordPress
Settings → Reading → "Discourage search engines from indexing this site" only adds a noindex meta tag. It is a hint and can be lost on push-to-live, so also use host-level password protection. On WP Engine, enable it in the User Portal under the environment's Password Protection. Kinsta and SiteGround offer similar options on their staging environments.
Shopify
Development stores and unpublished theme previews aren't public stores, but a separate staging store is. Enable Online Store → Preferences → Password protection on it. Theme preview links (?preview_theme_id=) are canonicalised to the live store, so they rarely need extra work.
Webflow
The *.webflow.io staging domain is indexable by default. In Site settings → SEO, turn on "Disable Webflow subdomain indexing", and add password protection in Site settings for sensitive builds before publishing to the custom domain.
Vercel / Netlify
Preview deployments send X-Robots-Tag: noindex automatically, but production deployments on *.vercel.app or *.netlify.app do not. Use Vercel Project Settings → Deployment Protection (Vercel Authentication or Password Protection), or Netlify Site configuration → Access & security → Visitor access. Also redirect the platform subdomain to your custom domain.
Cloudflare
If staging is proxied through Cloudflare, protect it with Zero Trust → Access → Applications → Add an application → Self-hosted, using staging.example.com and an email or SSO policy. Crawlers then get a login redirect instead of content. Add the X-Robots-Tag header with a Transform Rule (Rules → Transform Rules → Modify Response Header).
Check that it worked
✅ How to verify
- curl -I on each staging hostname returns 401 (or a Cloudflare Access login) and an X-Robots-Tag: noindex header, while www.example.com returns 200 with no noindex.
- Search Console URL Inspection on a staging URL shows it is excluded or blocked after recrawl, and Indexing → Removals shows the prefix request as Approved.
- site:staging.example.com and site:example.com -site:www.example.com return no staging results in Google and Bing within 1-4 weeks.
- Search Console Performance, filtered by page containing "staging", shows impressions dropping to zero.
⚠️ Common mistakes
- Adding Disallow: / to staging robots.txt first, which stops Google from seeing the noindex and leaves the URLs indexed.
- Relying only on the Search Console Removals tool, which is temporary. The pages return after about six months if staging is still public.
- Copying the noindex header or setting to production during a staging-to-live deploy, which de-indexes the real site.
- Protecting staging.example.com but forgetting platform hostnames like example.vercel.app, example.webflow.io or example.wpengine.com that serve the same content.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
How do I check if my staging site is indexed by Google?
Search site:example.com -site:www.example.com and site:staging.example.com in Google. Also search your brand name with platform domains like site:vercel.app. In Search Console, a Domain property lists every subdomain with impressions under Performance → Search results.
Is robots.txt enough to keep a staging site out of Google?
No. robots.txt controls crawling, not indexing. Google can still index a blocked URL if other pages link to it, and it can't see a noindex on pages it isn't allowed to crawl. Use HTTP authentication plus an X-Robots-Tag noindex header instead.
How long does it take Google to remove an indexed staging site?
A Search Console prefix removal hides the URLs within about a day. Permanent removal happens as Google recrawls and sees the 401 or noindex, which usually takes one to four weeks, longer for rarely crawled URLs.
Will an indexed staging site hurt my main site's rankings?
It can. Staging copies are duplicate content that can be chosen as the canonical version instead of your live pages. They also split link signals and can send users to outdated or broken pages. Removing them lets ranking signals go back to the production URLs.
How to Fix Old URLs That Return 404 After a Redesign
How to Enable IndexNow So New Pages Are Submitted on Publish
How to Fix Old URLs That Redirect to the Homepage
How to Serve Your Website Through a CDN Near Your Audience
How to Install Analytics on Every Page of Your Site
How to Fix JavaScript Console Errors on Your Website