robots.txt — What It Does NOT Do for SEO
A ticket appears: “Add /admin to robots.txt so Google cannot see it.” That line might reduce crawl noise. It will not password-protect the admin panel, and it will not magically erase URLs already indexed. robots.txt is a politeness file, not a lock — and treating it like a firewall creates both security theater and SEO confusion.
What robots.txt is actually for
Search engines and other well-behaved bots fetch /robots.txt to learn crawl preferences:
User-agent: *
Disallow: /api/internal/
Allow: /api/public/
Sitemap: https://example.com/sitemap.xml
Use it to keep low-value parameters and infinite filters from wasting crawl budget, to point at sitemaps, and to segment rules per user-agent when you truly need that. Do not use it as the only line of defense for anything sensitive.
Generate a starting file with a robots.txt generator, then review by hand — generators do not know your auth model or which faceted URLs explode crawl budget.
Myths that cause incidents
| Belief | Reality |
|---|---|
| Disallow = secret | The file itself advertises sensitive path prefixes |
| Disallow = deindex now | Fetching stops; indexing behavior is separate |
| Bad bots obey it | Malicious scrapers ignore it |
Disallow: / on prod “for launch” | Easy to forget and leave live |
| Blocking CSS/JS “hides” design | Modern Googlebot needs assets to render |
If a path must stay private: authentication, not robots. Listing /admin in Disallow is free reconnaissance for anyone who reads the file.
Disallow vs noindex vs auth
Need Tool
---------------------------- -----------------------------
Do not crawl robots.txt Disallow
Do not index (if crawled) meta / X-Robots-Tag noindex
Do not access Login / VPN / signed URLs
A page that is Disallowed may still show as a URL-only result when other sites link to it. A page with noindex that remains crawlable can drop from the index after recrawl. A page behind auth does not need to be in the sitemap at all.
Combining Disallow with noindex is tricky: if bots cannot fetch the page, they may never see the noindex directive. For URLs already indexed that you want gone, prefer allowing crawl with noindex, or use Search Console removals while you add auth.
Staging and preview environments
Minimum bar:
- HTTP basic auth, SSO, or IP allowlist
X-Robots-Tag: noindex, nofollow- Optional
Disallow: /in robots.txt
Any one alone can fail: auth disabled “temporarily,” header stripped by a CDN, robots mis-copied to production. Stack them. Put production robots.txt in deploy diffs so an accidental sitewide Disallow is caught before it becomes an SEO outage.
Preview deployments (Vercel/Cloudflare Pages) should inherit noindex by default — do not copy production robots that Allow everything onto a public *.pages.dev URL full of draft content.
Writing rules without shooting yourself
- Be specific: block noisy
/search?faceted URLs rather than entire useful sections - Test with Search Console’s robots tooling after deploy
- Do not block CSS/JS the crawler needs to render critical content
- Keep sitemap URLs consistent with what you allow
- Avoid contradictory Allow/Disallow pairs you cannot explain in one sentence
- Prefer one clear
User-agent: *block unless you have a documented per-bot policy
On large sites, blocking infinite calendar and sort combinations helps bots spend time on canonical pages. On a thirty-page marketing site, obsessing over crawl budget usually matters less than fixing soft-404s and slow TTFB. Match effort to scale.
AI crawlers and explicit policy
Training and scraping bots may honor robots.txt, a separate AI policy file, or neither. Decide Allow/Disallow explicitly for agents you care about; do not assume defaults match your content license. Review vendor docs when you add product-specific user-agents — syntax mistakes silently fall through to *.
Operational checklist
- Never list secret admin URLs as the only “protection.”
- After blocking a section, use Search Console for indexed URLs that must disappear.
- Monitor production robots.txt in deploy review — accidental
Disallow: /is a classic outage. - Pair sitemap and robots: do not advertise URLs you disallow without a documented reason.
- Re-fetch robots.txt after CDN or Workers changes that might serve a different file by host.
- Treat AI crawlers like any other bot: decide Allow/Disallow on purpose.
robots.txt shapes crawler etiquette. SEO outcomes still depend on content, links, status codes, and indexability signals. Use Disallow for crawl hygiene, noindex for index control, and real auth for secrets — and stop treating a public text file like a firewall.