How to Keep a Page Out of Google Search
Hide thank-you pages, staging sites and old offers from Google with noindex, not robots.txt. Meta tag and header examples, plus how to remove a page fast.
· 7 min read
To keep a page out of Google, add <meta name="robots" content="noindex"> to its <head> (or send an
X-Robots-Tag: noindex header), make sure robots.txt does not block it, and let Google crawl it again.
Blocking a page in robots.txt doesn't hide it: Google can still list the URL, it just can't read the page.
If the page is already showing in results and needs to go today, use Search Console's Removals tool as well.
Anything genuinely private should be behind a password or deleted, not just hidden. Each method below takes a
few minutes.
Why this is worth checking now#
On 21 October 2026 Google refreshed its page on controlling what you share with Google Search, the overview of every way a site owner can keep content out of results. Nothing in it is brand new, but it's a good reminder of which tools Google actually supports, and the run-up to Christmas is when small sites tend to collect pages they don't want found: a staging copy of the new menu, a gift voucher thank-you page, a Black Friday page that's finished, or a PDF price list from last year.
Typical pages to hide on a small-business site:
- Thank-you and confirmation pages after a form or payment, so nobody lands on "Thanks for your order" from Google.
- Staging or preview copies of the site, which duplicate your real pages.
- Your 404 page.
- Old offers and internal pages, such as a staff rota or a client proof page.
Option 1: the noindex meta tag (any site)#
Google's guide to blocking indexing with noindex
says that once Googlebot crawls a page and finds the rule, it drops the page from results entirely, even if
other sites link to it. Put this inside the page's <head>:
<meta name="robots" content="noindex" />That works with every search engine that supports the rule. Use name="googlebot" instead if you only want
to affect Google. You can combine rules, for example content="noindex, nofollow".
Several Freeframe templates already do this on their error page: the Atlas,
Forge and Smile 404.html files carry the same tag, so you can copy
the line from there.
How to add it in each stack:
- HTML: paste the tag into the
<head>of each page you want hidden. Leave it out of every other page. - Next.js: export
metadatafrom that route'spage.tsxwithrobots: { index: false }. ThegenerateMetadatareference lists therobotsoptions, and Next.js writes the matching<meta name="robots">tag for you. - Astro: add the tag to that page's
<head>, or pass anoindexprop to your layout and output the tag only when it's set. - WordPress: an SEO plugin usually adds a "noindex" option to each page's settings. To hide a whole
site, such as a staging copy, tick Settings > Reading > Search engine visibility. The
WordPress Reading Settings guide says
that since version 5.3 this adds a
noindex,nofollowrobots tag to every page. Untick it before launch.
Option 2: the X-Robots-Tag header (PDFs, images and whole folders)#
A meta tag only works in HTML. For a PDF menu, an old price list or a folder of client proofs, send the same
rule as an HTTP header. Google treats X-Robots-Tag: noindex the same as the meta tag, and its
robots meta tag specification
lists every rule both accept.
On Netlify and Cloudflare Pages, add a plain text file called _headers (no extension) to the folder you
deploy. For example, to hide every PDF in a downloads folder and a thank-you page:
/downloads/*
X-Robots-Tag: noindex
/thank-you.html
X-Robots-Tag: noindexThe syntax is the same on both: a path on one line, indented headers below it. See Netlify's custom headers docs and Cloudflare Pages' headers docs. Cloudflare notes a limit of 100 header rules at the time of writing, and both say these headers don't apply to pages generated by functions or server-side rendering; those need the header set in code.
On Vercel, add the header in vercel.json or, for a Next.js site, with the headers() function in
next.config.js. If your host doesn't let you set headers, use the meta tag for pages and remove or
password-protect files you don't want found.
To check a header is live, run curl -I with the page's address and look for x-robots-tag: noindex in the
output.
Don't use robots.txt to hide pages#
This is the most common mistake. Google's introduction to robots.txt is blunt: it's "not a mechanism for keeping a web page out of Google". If other pages link to a blocked URL, Google can still index the address and show it without a description.
Worse, the two methods cancel each other out. Google can only see a noindex rule if it's allowed to fetch the
page, so a page that is both blocked in robots.txt and tagged noindex can stay in results. If you're
hiding a page with noindex, check robots.txt has no Disallow line covering it.
robots.txt is still the right tool for two jobs: keeping crawlers away from unimportant pages, and keeping
image, video and audio files out of Google's results. Our
launch checklist covers what a normal robots.txt and sitemap should
contain.
Preview and staging sites#
Most hosts already keep preview deployments out of Google, but production on the host's own address is a different story:
| Host | Previews hidden by default? | Watch out for |
|---|---|---|
| Vercel | Yes: previews and outdated production deployments get noindex |
A custom domain on a preview branch has no noindex |
| Netlify | Yes: Deploy Previews get noindex |
Netlify recommends a password or private project to be sure |
| Cloudflare Pages | Yes: every preview deployment gets noindex |
Your production project.pages.dev address isn't hidden unless you add a header |
If your site has a custom domain on Cloudflare Pages, add this to _headers so the pages.dev copy of your
site doesn't compete with it, as
Cloudflare's headers docs suggest:
https://:project.pages.dev/*
X-Robots-Tag: noindexLeave the :project placeholder as it is; Cloudflare fills it in. For a staging. subdomain you've set up
yourself, the safest choice is a password, which keeps out search engines and people.
If the page is already in Google#
Adding noindex doesn't remove a page straight away. Google has to recrawl it first, and Google's noindex guide
says that can take months for a page it rarely visits. To speed things up:
- Add
noindex(or delete the page, or put it behind a password) so the removal sticks. - Ask Google to recrawl it. In Search Console, paste the address into the URL Inspection tool, check the live page shows the rule, and click Request indexing.
- Hide it now with the Removals tool. Google's guide to removing a page hosted on your site says the Removals tool can hide a page within a day, but requests last about six months. That's why step 1 matters: without it, the page can come back.
- Cover every version of the address. Google's guide gives the example that
example.com/puppies,example.com/PUPPIESandexample.com/petchooser?pet=puppiescan all be the same page.
Afterwards, the Page indexing report in Search Console
lists the pages where Google found your noindex rule, which is a quick way to confirm it worked, and to spot
a page you hid by mistake.
Hiding part of a page, or just the AI answers#
Sometimes you want the page in Google but not everything on it:
- Hide a block of text from the snippet with the
data-nosnippetattribute, for example on a staff phone number:<span data-nosnippet>01632 960123</span>. Google's robots meta tag specification supports it onspan,divandsectionelements. - Show no snippet at all with
<meta name="robots" content="nosnippet">, or limit its length withmax-snippet:50. - Take a dated offer down automatically with
unavailable_after, for example<meta name="robots" content="unavailable_after: 2026-12-01">on a Black Friday page you won't reuse. If you will reuse it, follow our Black Friday guide instead. - Stay in Search but leave AI Overviews and AI Mode with the Search generative AI control in Search Console, which applies to the whole site. Our post on AI Overviews data in Search Console explains what excluding your site means before you switch it.
A five-minute check#
- Search Google for
site:yourdomain.comand look for thank-you pages, test pages and old PDFs. - Add
noindex(meta tag or header) to anything that shouldn't be there. - Open
robots.txtand make sure it doesn't block those pages. - Check your preview and
pages.devornetlify.appaddresses withcurl -I. - Use URL Inspection and, if it's urgent, the Removals tool.
Our SEO docs cover the other half of the job: the titles, descriptions and sitemap that help the pages you do want found.