Noindex or Disallow? Keep Pages Out of Google the Right Way
Private pages showing up in Google even though you blocked them in robots.txt? Or good pages stuck out of Google because of a noindex you can't even find? This prompt finds the conflict, picks the right control for every page type and gives you the exact fix.
Example input
This is exactly what we gave the model. You replace it with your own details.
- Website: https://www.example.com (project management SaaS; the app runs on app.example.com) - Platform and CDN: Next.js on Vercel, behind Cloudflare - Pages I want OUT of Google: Shared report links (/share/*), account pages (/account/*), internal search (/search?q=), thank-you pages (/thank-you/*) - Pages that SHOULD be in Google but are not: /pricing/ and /features/integrations/ were in Google until last month and now they are gone - Current robots.txt (paste): User-agent: * Disallow: /share/ Disallow: /account/ Disallow: /search Disallow: /thank-you/ Disallow: /pricing-old/ - What Search Console shows: 'Indexed, though blocked by robots.txt' for 230 /share/ URLs. 'Excluded by noindex tag' for /pricing/ and /features/integrations/, but I can't see any noindex tag in the page source.
Real output
Pasted straight from the model. We did not fix a word.
Quick questions (I'm using my guesses until you correct me)
- Where do share links live:
www.example.com/share/...orapp.example.com/share/...? Guess: on www, because they are in your www robots.txt. - Can a shared report hold private client data? Do share links expire or need a password? Guess: yes, they can show client and project names. Links are long random IDs with no expiry and no password.
- Which Next.js router and version? Guess: App Router, Next.js 14 or 15.
- What changed about a month ago?
Guess:
/pricing-old/was retired. In the same release, a header rule, Cloudflare rule or template/CMS change added a noindex that hits/pricing/and/features/integrations/. - What do logged-out visitors get on
/account/*? Guess: a redirect to/login. You want/loginto stay in Google for "example login" searches.
1. Decision table
| Page type | Right control | Current setup | Problem | Fix |
|---|---|---|---|---|
/share/* shared reports | Access control (password or login option, plus expiry) and X-Robots-Tag: noindex, nofollow. Crawling allowed | Disallow: /share/. No noindex (guess) | 230 URLs "Indexed, though blocked by robots.txt". Google can't crawl them, so it can never see a noindex. Anyone with a link can open the report | Add the noindex header, then remove Disallow: /share/. Add password/expiry for sensitive reports. Use Removals for urgent ones |
/account/* | Login (already there, guess) + X-Robots-Tag: noindex. Crawling allowed | Disallow: /account/ | If anyone links to an account URL, Google can index the bare URL and never sees a noindex | Keep the login. Add the noindex header. Remove the Disallow |
/search?q= | X-Robots-Tag: noindex, follow. Crawling allowed | Disallow: /search | Spam sites can link to /search?q=spam-words, and those URLs can get indexed while blocked. Also, /search is a prefix: it blocks every path that starts with /search (for example /search-reports/) | Noindex header on /search only. Remove the Disallow. Never link to search result URLs |
/thank-you/* | X-Robots-Tag: noindex. Crawling allowed | Disallow: /thank-you/ | Can be indexed from links. People who land there from Google fire fake conversions in your ads and analytics | Noindex header. Remove the Disallow |
/pricing/ | None (must be indexable) | "Excluded by noindex tag". No noindex in page source | Hidden noindex: a header, Cloudflare rule, cached copy, Next.js metadata or JavaScript. robots.txt is not the cause: /pricing-old/ only matches paths that start with /pricing-old/ | Find the source (checklist below). Remove it. Purge cache. Request indexing |
/features/integrations/ | None (must be indexable) | Same as /pricing/ | Same hidden noindex. Two pages with the same problem usually share one cause | Same as /pricing/ |
/pricing-old/ (not on your list) | 301 redirect to /pricing/. No robots.txt rule | Disallow: /pricing-old/ | Google can't crawl it, so it never sees a redirect. Old links don't pass value to /pricing/ (guess: the page is retired) | Remove the Disallow. 301 it to /pricing/ |
app.example.com (not on your list) | Login + X-Robots-Tag: noindex on every path except the login page | Unknown (guess: nothing set). Your www robots.txt does not apply here, because robots.txt works per host | App URLs that leak (emails, public docs, tickets) can get indexed | Give the app host its own open robots.txt and a noindex header (code below) |
Why each control (one line each)
- Share links: to Google they are public pages. The 2026 case where shared AI chats showed up in Google was your exact setup: blocked in robots.txt, so the noindex was never seen. Noindex keeps them out of search, and a password keeps them private.
- Account: the login already hides the content. Noindex covers the bare URL, and allowing the crawl is what lets Google see the noindex.
- Internal search: these are low-value pages with no end, so noindex keeps them out. Your marketing site is small, so crawl budget is no reason to block them.
- Thank-you: no search value, and it messes up conversion data. Noindex is enough.
- Pricing and Integrations: these are money pages. They need no control at all. The hidden noindex just has to go.
- /pricing-old/: a redirect sends people and link value on to
/pricing/. A Disallow hides that redirect from Google.
Conflicts found in your setup
- Disallowed pages that need noindex: all four of your "keep out" types (
/share/,/account/,/search,/thank-you/) rely only on robots.txt. The 230 share URLs prove that robots.txt can't keep pages out. - Noindex pages that are also blocked: if any of those four already sends a noindex (check with curl below), Google never sees it today. That is the same trap as in the AI share case.
- Good pages blocked by mistake: nothing in your robots.txt blocks
/pricing/or/features/integrations/. Search Console agrees: it says "noindex", not "Blocked by robots.txt". ButDisallow: /searchmay block other paths that start with/search, andDisallow: /pricing-old/hides a redirect. - Good pages with noindex:
/pricing/and/features/integrations/. The noindex is hidden somewhere (next section).
2. Hidden noindex checklist (with commands)
Run these on /pricing/ and /features/integrations/. Do step 1 first, because it often tells you where to look.
Step 1: Ask Google where it saw the noindex
- Search Console > URL Inspection > paste the URL > Test live URL.
- Read the "Indexing allowed?" line:
'noindex' detected in 'X-Robots-Tag' http headermeans it's a header. Go to steps 3–6.'noindex' detected in 'robots' meta tagmeans it's in the HTML. Go to steps 2, 6, 7 and 8.- "Yes" in the live test while the report still says noindex means it was fixed already, or it comes and goes (a cached copy). Go to step 5.
- Click View tested page. Open HTML (this is the rendered HTML) and More info > HTTP response (headers). Search both for
noindex.
Step 2: Raw HTML (what view-source shows)
# Raw HTML before JavaScript. Catches name="robots" AND name="googlebot".
curl -sL https://www.example.com/pricing/ | grep -ioE '<meta[^>]*(robots|googlebot)[^>]*>'
In the browser, open view-source:https://www.example.com/pricing/ and search for noindex and googlebot. People often search only for "robots" and miss <meta name="googlebot" content="noindex">.
Step 3: HTTP headers, every redirect hop
# GET request, headers of every hop, body hidden
curl -sL -o /dev/null -D - https://www.example.com/pricing/ \
| grep -iE '^(HTTP|location|x-robots-tag|cf-cache-status|age|x-vercel-cache)'
# Also test without the trailing slash (Next.js may redirect one to the other)
curl -sL -o /dev/null -D - https://www.example.com/pricing \
| grep -iE '^(HTTP|location|x-robots-tag)'
Use a GET like this, not only curl -I. -I sends a HEAD request, and some setups answer HEAD differently.
Step 4: As Googlebot (desktop and smartphone)
GB='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
GBM='Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
curl -sL -o /dev/null -D - -A "$GB" https://www.example.com/pricing/ | grep -iE '^(HTTP|x-robots-tag|cf-cache-status)'
curl -sL -o /dev/null -D - -A "$GBM" https://www.example.com/pricing/ | grep -iE '^(HTTP|x-robots-tag|cf-cache-status)'
# Does the HTML Googlebot gets differ from what a browser gets, on the noindex line?
diff <(curl -sL https://www.example.com/pricing/) \
<(curl -sL -A "$GBM" https://www.example.com/pricing/) | grep -i noindex
Note: Cloudflare knows your IP is not a real Googlebot, so it may treat your request differently. The live test in step 1 is the true Googlebot view. Use curl to narrow down the cause.
Step 5: Skip Cloudflare and ask Vercel directly
# Sends the request straight to Vercel with your real host name.
# 76.76.21.21 is Vercel's usual A-record IP. Check it on your Vercel Domains page.
curl -s -o /dev/null -D - --resolve www.example.com:443:76.76.21.21 \
https://www.example.com/pricing/ | grep -iE '^(HTTP|x-robots-tag|x-vercel)'
- Noindex from Vercel too: the cause is in your Next.js code or Vercel settings. Go to step 6.
- Noindex only through Cloudflare: it's a Cloudflare rule or an old cached copy. Check the Cloudflare dashboard:
- Rules > Transform Rules > Response Header rules: any rule that sets
X-Robots-Tag. - Workers Routes on
www.example.com/*, and Snippets. - Cache Rules / Page Rules: "Cache Everything" with a long Edge TTL can keep serving an old noindex copy. The clue is
cf-cache-status: HITwith a bigagevalue. Purge both URLs. - Manage Account > Audit Log: filter to last month. It shows who changed which rule, and when.
- Rules > Transform Rules > Response Header rules: any rule that sets
- Don't test on
*.vercel.appor preview URLs. Vercel addsX-Robots-Tag: noindexthere on purpose, so a noindex there proves nothing.
Step 6: Search your code and Vercel settings
# Every place that can set noindex in a Next.js project
grep -rniE "noindex|x-robots-tag|index:\s*false|robots\s*:" \
--include=*.{js,jsx,ts,tsx,mjs,cjs,json} \
--exclude-dir={node_modules,.next,.vercel} .
# Commits from the last ~2 months that added or removed noindex / robots code
git log --since="2 months ago" -S"noindex" --oneline --all
git log --since="2 months ago" -G"X-Robots-Tag|robots" --oneline --all
Where to look:
next.config.js>headers(): asourcethat is too broad. For example, a rule for the old page written as/pricing(.*)also matches/pricing/(guess: the top suspect for pricing).next.config.js>rewrites(): if/pricing/or/features/integrations/is sent to another Vercel project or to a*.vercel.app/ preview URL, that response brings Vercel's noindex header with it.middleware.ts:response.headers.set('X-Robots-Tag', ...)with a widematcher.vercel.json>headers.app/**/layout.tsxandpage.tsx:metadata.robotsorgenerateMetadata(). A shared layout withrobots: { index: false }hits every page under it. Also look for env checks likeindex: process.env.VERCEL_ENV === 'production'. If the check reads the wrong variable, or a static page was built in a preview build, the page ships with noindex.- Pages Router or packages:
pages/_document,next/head, and next-seo (<NextSeo noindex />, orDefaultSeowithdangerouslySetAllPagesToNoIndex). - Vercel > Settings > Domains:
www.example.commust point to Production, not to a Git branch (a preview).
Step 7: "SEO plugin" settings (on Next.js this means your CMS and SEO packages)
- If pricing and integrations come from a headless CMS, look for a "noindex" or "hide from search engines" toggle on those two entries. Also check for a new default on their content type.
- Check the defaults in your next-seo or next-sitemap config.
- Ask what the two pages have in common: the same layout, CMS type or component. Look there first.
Step 8: JavaScript
- Compare the raw HTML (step 2) with the rendered HTML (step 1 "View tested page" > HTML, or Chrome DevTools > Elements, then search for
noindex). - Noindex only in the rendered HTML: JavaScript adds it. Suspects are a component that sets
<meta name="robots">inuseEffect, a Google Tag Manager Custom HTML tag, an A/B testing or consent tool, or Cloudflare Zaraz. Search your GTM container for "noindex". - Noindex in the raw HTML that JavaScript "removes" later: still broken. Google may skip rendering a page whose raw HTML says noindex. Fix it in the server HTML.
3. Code
robots.txt for www.example.com
# https://www.example.com/robots.txt
# Crawl control only. Pages we keep out of Google use noindex headers, not Disallow.
User-agent: *
Disallow:
Sitemap: https://www.example.com/sitemap.xml
- The sitemap path is a guess. Use your real one.
- Don't block
/_next/. That folder holds your JS and CSS, and Google needs them to render your pages. - If you build robots.txt with
app/robots.ts, use one or the other, not both:
// app/robots.ts
import type { MetadataRoute } from 'next'
export default function robots(): MetadataRoute.Robots {
return {
rules: [{ userAgent: '*', allow: '/' }],
sitemap: 'https://www.example.com/sitemap.xml',
}
}
robots.txt for app.example.com
# https://app.example.com/robots.txt
# Open on purpose: the app is kept out of Google by login + noindex header, not by Disallow.
User-agent: *
Disallow:
Noindex headers and the old-pricing redirect (www, next.config.js)
// next.config.js
/** @type {import('next').NextConfig} */
const noindexNofollow = [{ key: 'X-Robots-Tag', value: 'noindex, nofollow' }]
const noindexFollow = [{ key: 'X-Robots-Tag', value: 'noindex, follow' }]
module.exports = {
async headers() {
return [
{ source: '/share/:path*', headers: noindexNofollow }, // HTML and any PDF/CSV exports (guess: reports can be exported)
{ source: '/account/:path*', headers: noindexNofollow },
{ source: '/thank-you/:path*', headers: noindexNofollow },
{ source: '/search', headers: noindexFollow }, // matches /search?q=anything
]
},
async redirects() {
return [
// guess: /pricing-old/ is retired
{ source: '/pricing-old/:path*', destination: '/pricing/', permanent: true },
]
},
}
Rules for this code:
- Exact paths only. Never use a broad pattern like
/pricing(.*). That kind of rule is the likely reason your pricing page got noindex (guess). - One place only. Set the header here, in your code. If you'd rather use Cloudflare, use one Response Header Transform Rule with the same four paths, and don't use both.
- Leave
/loginoff this list so it stays findable. - The header works for non-HTML files too (PDFs, CSVs, images), so exported reports are covered.
Backup meta tag on share pages (App Router)
// app/share/[id]/page.tsx
import type { Metadata } from 'next'
// If this page already uses generateMetadata(), return this robots field from there instead.
export const metadata: Metadata = {
robots: { index: false, follow: false },
}
The header is the main control. It doesn't depend on how Next.js renders the page. The meta tag is only a backup. Never add it with browser-side JavaScript.
Noindex header for app.example.com (guess: the app is also Next.js)
// next.config.js in the app project
module.exports = {
async headers() {
return [
{
// Every path except /login, so "example login" searches still find the login page
source: '/((?!login).*)',
headers: [{ key: 'X-Robots-Tag', value: 'noindex, nofollow' }],
},
]
},
}
What the pricing/integrations fix usually looks like
You'll only know the exact fix after the checklist. These are the two most likely patterns:
// WRONG: a rule meant for the old page that also matches /pricing/
{ source: '/pricing(.*)', headers: [{ key: 'X-Robots-Tag', value: 'noindex' }] }
// RIGHT: delete it. /pricing-old/ gets the 301 redirect above instead.
// WRONG: noindex in a shared layout, or set by an env check that fails
export const metadata = { robots: { index: false } }
// RIGHT: delete it (indexable is the default). Or state it on the money pages:
export const metadata = { robots: { index: true, follow: true } }
4. Ordered action plan
Phase 1: today. Bring back /pricing/ and /features/integrations/
- Run checklist steps 1–8 on both URLs and find the source.
- Remove it and deploy to production.
- Purge both URLs in Cloudflare (Caching > Configuration > Purge Custom URLs).
- Check again. curl (steps 3–5) must show no noindex, and the URL Inspection live test must say "Indexing allowed? Yes".
- Click Request indexing for both. They usually come back within a few days to two weeks.
- Add the check script from Phase 5 to your deploy pipeline, so a noindex can't ship to these pages without anyone noticing.
Phase 2: release A. Add noindex to the "keep out" pages (robots.txt not changed yet)
- Deploy the
headers()rules for/share/,/account/,/thank-you/and/search, plus the/pricing-old/redirect. - Confirm in production. Use a test share link you made yourself:
Every URL must showfor u in "https://www.example.com/share/YOUR-TEST-ID" \ "https://www.example.com/account/" \ "https://www.example.com/search?q=test" \ "https://www.example.com/thank-you/YOUR-TEST-PAGE/"; do echo "$u"; curl -s -o /dev/null -D - "$u" | grep -iE '^(HTTP|x-robots-tag)' donex-robots-tag: noindex. A redirect to/loginon/account/is also fine. - Start the product fix for share links in parallel: a password or login option, an expiry date, and a way to revoke a link. Links leak from public forums and docs, and you can't stop that. So the page itself must say noindex, and private reports must need a password.
Phase 3: release B. Open robots.txt (only after step 8 passes)
- Deploy the new robots.txt. You can ship it in the same release as the headers. Just never let the robots.txt change go live first. If Google crawls an open share page with no noindex, it can index the full report, title and text included, not just a bare URL.
- Purge
/robots.txtin Cloudflare. Check it withcurl -s https://www.example.com/robots.txt. - Search Console > Settings > robots.txt report > Request a recrawl. Google usually refreshes its copy within about 24 hours.
Phase 4: clean up the 230 share URLs already in Google
- Export the list: Search Console > Pages > "Indexed, though blocked by robots.txt" > Export.
- Urgent cases: if any URL or title shows a client name or private data:
- Revoke that link so it returns 404 or 410.
- Use Removals > Temporary removals. Because no share URL should ever be in search, you can safely choose "Remove all URLs with this prefix" for
https://www.example.com/share/. One request hides all of them, usually within a day. - Remember it's temporary (about 6 months). The noindex or the 404 does the permanent work.
- Speed up the recrawl: submit a temporary sitemap that lists the 230 share URLs (for example
/sitemap-share-cleanup.xml). Search Console will warn "Submitted URL marked noindex". That's expected. Delete the sitemap once the URLs are gone. - Watch the numbers weekly. "Indexed, though blocked by robots.txt" for
/share/should fall to 0, and "Excluded by noindex tag" for/share/should rise. That shift proves it's working. - How long: most of these low-traffic URLs drop out in 2–8 weeks. The last few can take 3 months or more. The prefix removal covers you while you wait.
- Never put
Disallow: /share/back after they're gone. New links to new share URLs would bring the problem back, and Google would again be unable to see the noindex.
Phase 5: monthly check (15 minutes, same day each month)
- Search Console > Pages:
- "Indexed, though blocked by robots.txt": should be 0, since you have no Disallow lines now.
- "Excluded by noindex tag": scan it for money pages (pricing, features, integrations, blog, docs). This check would have caught the pricing problem a month ago.
- Indexed pages: filter for
/share/,/account/,/thank-you/and/search. The list should be empty.
- Quick Google checks:
site:www.example.com inurl:share,site:app.example.com,site:www.example.com inurl:thank-you. site: results are rough, but they're good for spotting leaks. - Run the script below. Also run it on every production deploy.
- Compare the live robots.txt to the file in your repo. Cloudflare can add lines, for example with its managed robots.txt feature.
- Review last month's changes: the Cloudflare Audit Log, plus
git log --since="1 month ago" -S"noindex". Look for any new header, rule or metadata change that touches robots. - Spot-check one brand-new share link in production. Its header must show noindex.
#!/usr/bin/env bash
# index-check.sh: run monthly and on every production deploy. Exits 1 if something is wrong.
UA='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
MUST_INDEX=(
"https://www.example.com/"
"https://www.example.com/pricing/"
"https://www.example.com/features/integrations/"
)
MUST_NOINDEX=(
"https://www.example.com/share/YOUR-TEST-REPORT-ID"
"https://www.example.com/account/"
"https://www.example.com/search?q=test"
"https://www.example.com/thank-you/YOUR-TEST-PAGE/"
)
has_noindex() {
curl -sL -A "$UA" -D - "$1" | grep -qiE 'x-robots-tag:.*noindex|<meta[^>]*noindex'
}
fail=0
for u in "${MUST_INDEX[@]}"; do
if has_noindex "$u"; then echo "PROBLEM noindex on a page that must rank: $u"; fail=1
else echo "ok indexable: $u"; fi
done
for u in "${MUST_NOINDEX[@]}"; do
if has_noindex "$u"; then echo "ok noindex: $u"
else echo "PROBLEM noindex missing: $u"; fail=1; fi
done
if curl -s https://www.example.com/robots.txt | grep -qiE '^disallow:\s*/'; then
echo "CHECK robots.txt has Disallow rules again. Make sure none of them hide a noindex."; fail=1
fi
exit $fail
If any of my guesses at the top are wrong, tell me which one. I'll adjust the table and the code to match.
The prompt
First lines open so you can see how it is built. The rest opens after purchase.
#ROLE You are a technical SEO expert who specializes in crawl and index controls: robots.txt, meta robots and X-Robots-Tag. Help me make sure the right pages are in Google and the wrong ones are out. #INPUTS Fill in every line. Leave a line blank if you don't know it. - Website: [WEBSITE URL] - Platform and CDN: [e.g., WordPress + Cloudflare, Next.js on Vercel, Shopify] - Pages I want OUT of Google: [e.g., shared links, account pages, internal search, staging, thank-you pages, PDFs]
How to use it
- Buy, then open it in your account.
- Copy the prompt into ChatGPT, Claude or Gemini.
- Replace the 6 inputs with your product.
- Run it. Use the output. Re-run with a different tone if you like.
Pro tips
- Paste your real robots.txt. Most leaks come from a disallow line that hides a noindex.
- Follow the order of changes it gives you. Adding the noindex before you remove the disallow keeps private pages from slipping into Google in between.
- For share links, ask for the X-Robots-Tag header version. One header rule is easier than changing every page.
Before you buy
- Will it work for my product?
- Yes, if you can fill the 6 inputs. If the output is bad with your inputs, email us: we fix the prompt and refund you.
- Do I download a file?
- No. It lives in your account with a copy button, and updates when we improve it.
- Which model is best?
- Best on Claude. Works in ChatGPT, Claude and Gemini.
Works well with this
Prompts people use in the same campaign.
More in Crawling & Indexing
Buying more than two? Lifetime is cheaper.
Every prompt, every category, forever. $59 once. Nothing to download, nothing to renew.
This prompt
$3$7
- ✓ Instant access in your account, with a copy button
- ✓ Example input and real output included
- ✓ 7-day money-back, no form
Or get every prompt, forever
Lifetime Access · $59 $149 — all categories, all future prompts, rewrites included.
Get lifetime accessCard or PayPal · taxes at checkout · nothing to download
Not the one you need?
Browse every prompt by category and sub-category.