Netlify
Netlify staging site indexed by Google: fix it
Netlify can index the newest branch deploy. Add a branch-only X-Robots-Tag without blocking the production site.
Netlify automatically noindexes Deploy Previews and older branch deploys, but the newest stable branch deploy can remain indexable. Check its response, add "X-Robots-Tag: noindex" through the branch-specific header file and build context, redeploy, then verify the public staging URL returns the header before requesting removal from Google.
Why Netlify does this
Netlify adds "X-Robots-Tag: noindex" to Deploy Previews, unpublished production deploys, and old branch deploys. It explicitly allows the most recent branch deploy to be indexed. A stable staging branch URL is a Branch deploy, not a Deploy Preview, so its newest version needs its own header.
Check it right now
Before changing anything, confirm what a crawler actually sees. The check is free, takes one URL and needs no account.
How to fix it
- Run the X-Robots-Tag checker on the exact staging URL. A URL beginning with "deploy-preview-" should already return "X-Robots-Tag: noindex". If it does, Netlify is already handling that preview.
- For an indexable branch deploy, create custom-headers/_stagingHeaders. Put "/*" on the first line and "X-Robots-Tag: noindex" indented on the next line.
- In netlify.toml, use the exact branch context, such as "[context.staging]", and append "&& cp ./custom-headers/_stagingHeaders ./dist/_headers" to that context build command. Replace "staging", "dist", and the build command with the real branch and paths.
- Redeploy the branch and run the checker again. Confirm the stable staging URL now returns "X-Robots-Tag: noindex".
- If the branch URL is already visible in Google, use Search Console > Removals > Temporary Removals > New Request after the header is live. Remove the staging prefix only. The request is temporary; the response header is what keeps the branch out.
Why it happens again
Netlify protects Deploy Previews and old branch deploys, not the newest branch deploy. Every push updates the stable branch URL, so the branch-specific _headers file must be copied into every build.
stillindexed re-checks the URLs you give it every 30 minutes on Starter and alerts when a directive changes, at most 30 minutes after it does. It is a monitor rather than a crawler: it watches a list you choose and tells you when one of seven things changes. Card first, no trial, and a 30 day refund.
Catching it next time
Fixing it once is the easy half. The setting that caused this can be changed again by anyone with access, and the page will keep returning 200 while it happens.
Other ways Netlify loses pages
- my Netlify robots.txt is blocking pages that should be crawled
- The live site lands on the right URL after two hops, or the www and non-www versions disagree about which one is real.
- A Netlify site warns of an insecure connection because the Let's Encrypt certificate never provisioned or stopped renewing.
A staging or preview site indexed by Google, on other platforms
Sources
Every claim about Netlify above is from their own documentation, read on 2026-08-30. Platforms change their settings; if one of these is out of date, their page wins and we would like to know.