Sub topic 10
Letting the Right Crawlers Reach Your Content
This chapter assumes you can edit a site's root files, you know basic HTML, and you have seen a URL path such as /blog/post. You do not need to know how a web server works. If you only edit content in a CMS, you can still follow along, but you may need a developer to apply the changes.
Why access comes before everything else
An AI system can only quote a page it has been able to fetch. Perfectly structured, answer-first writing does nothing if a crawler is blocked by robots.txt, a firewall rule, or a login wall. Access is the gate in front of every other technique in this tutorial.
A crawler (also called a bot or spider) is a program that requests web pages automatically. Each crawler announces itself with a user-agent token, a short name such as OAI-SearchBot. A robots.txt file is a plain-text file at the root of your site, for example https://example.com/robots.txt. It tells crawlers which paths they may request.
Two points about robots.txt matter before any syntax:
- It is a request, not a lock. Well-behaved crawlers follow it. Badly behaved ones ignore it. Do not use it to protect private data.
- It controls fetching by path. It does not remove a page that is already indexed, and it does not say anything about how content may be used once it has been collected.
Different bots do different jobs
A common mistake is to treat "AI crawlers" as one group. Vendors usually run several bots, and each has a different purpose. In general, they fall into three kinds:
| Purpose | What the bot does | Effect of blocking it |
|---|---|---|
| Search indexing | Builds an index that an AI search product queries to find and cite pages | Your pages may not appear as sources in that product |
| Model training | Collects content to train or improve a model | Your content is not collected for training by that vendor, if the vendor honors the rule |
| User-triggered fetching | Fetches a page when a person asks the assistant to read a URL or look something up | The assistant may be unable to read your page on request |
The tokens in this tutorial's example, OAI-SearchBot, GPTBot, PerplexityBot and ClaudeBot, are real examples of this split. In the example, OAI-SearchBot and GPTBot come from the same vendor but are documented for different purposes. Vendors rename, add and retire tokens, and they change what each one does. Check each vendor's current documentation before you rely on any name in this chapter.
How robots.txt rules are read
A robots.txt file is made of groups. Each group begins with one or more User-agent lines and is followed by rules for those agents.
User-agent: Xstarts a group for the crawler named X.Allow: /pathpermits that path prefix.Disallow: /pathforbids that path prefix.User-agent: *is the fallback group for any crawler that has no group of its own.- A blank
Disallow:with no value means nothing is disallowed.
Three behaviors cause most of the confusion:
- A crawler obeys the most specific group that names it, and only that group. If a bot has its own group, the
*group is ignored for that bot. Rules are not merged. - Matching is by path prefix.
Disallow: /privateblocks/private,/private/, and also/private-notes. Add the trailing slash if you mean only the directory. - When rules conflict inside a group, the most specific (longest) matching path generally wins. Major crawlers follow this convention, but older or smaller bots may not.
Here is the sample file from the topic, annotated line by line.
# robots.txt
User-agent: OAI-SearchBot
Allow: /
User-agent: GPTBot
Disallow: /private/
User-agent: PerplexityBot
Allow: /
User-agent: ClaudeBot
Allow: /
User-agent: *
Disallow: /admin/What each group means:
OAI-SearchBotmay fetch everything.GPTBotmay fetch everything except paths starting with/private/. With noAllowline, anything not disallowed is allowed.PerplexityBotandClaudeBotmay fetch everything.- Any other crawler may fetch everything except
/admin/.
Notice a gap. The named bots are not blocked from /admin/, because they have their own groups and never read the * group. If /admin/ must stay off limits to every bot, repeat that rule in each group. Better still, put admin pages behind authentication so the file is not your only protection.
Choosing a policy
There is no single correct policy. The decision depends on what you want from AI products and what you are willing to share. Weigh these criteria:
- Visibility goal. If you want to be cited in AI search answers, the search-indexing bots need access. Blocking them removes you from that source pool.
- Training preference. Some publishers allow search bots but disallow training bots. This is a legitimate and common split, but its effect depends on each vendor honoring the rule and on how the vendor documents it.
- Content value. Paywalled, licensed, or proprietary content may deserve a stricter rule than free documentation.
- Server load. Aggressive crawling can cost bandwidth. A
Crawl-delayline is honored by some crawlers and ignored by others, so do not depend on it. Rate limiting at the server or CDN is more reliable.
A policy that allows search-oriented bots and limits others looks like this:
# Allow bots that power AI search and citation
User-agent: OAI-SearchBot
Allow: /
User-agent: PerplexityBot
Allow: /
# Restrict a training-oriented bot to public docs only
User-agent: GPTBot
Allow: /docs/
Disallow: /
# Everyone else: keep private areas out
User-agent: *
Disallow: /admin/
Disallow: /account/In the GPTBot group, Disallow: / blocks everything, but Allow: /docs/ is longer and more specific, so /docs/ pages stay reachable. This relies on the longest-match convention, so test it rather than assuming it.
Other things that block crawlers
A correct robots.txt is not enough. Several other layers can stop a bot before it ever reads your rules.
- Firewalls, CDNs and bot protection. Security services often challenge or block unfamiliar automated traffic. A bot may be allowed in robots.txt and still receive a 403 error or a CAPTCHA.
- Login and paywalls. Crawlers do not sign in. Content behind authentication is invisible to them.
- Client-side rendering. Many crawlers do not run JavaScript, or run it poorly. If your answer text appears only after a script runs, the crawler may see an empty page. Serve the key text in the initial HTML.
- Meta robots and header directives. A
<meta name="robots" content="noindex">tag or anX-Robots-Tagresponse header can keep a page out of an index even when robots.txt allows fetching. Some vendors also honornosnippet-style directives, which limit quoting. Check the vendor's documentation for which directives it respects. - Errors and redirects. A robots.txt that returns a server error, or pages stuck in redirect chains, can cause crawlers to back off or skip your site.
Check your work
Verify access instead of trusting the file. A short script can read your live robots.txt the way a compliant crawler would. This one uses only Python's standard library.
from urllib.robotparser import RobotFileParser
SITE = "https://example.com"
AGENTS = ["OAI-SearchBot", "GPTBot", "PerplexityBot", "ClaudeBot", "SomeOtherBot"]
PATHS = ["/", "/docs/getting-started", "/private/notes", "/admin/login"]
parser = RobotFileParser()
parser.set_url(f"{SITE}/robots.txt")
parser.read()
print(f"{'agent':<16}" + "".join(f"{p:<26}" for p in PATHS))
for agent in AGENTS:
row = f"{agent:<16}"
for path in PATHS:
allowed = parser.can_fetch(agent, f"{SITE}{path}")
row += f"{('allow' if allowed else 'BLOCK'):<26}"
print(row)Replace example.com with your domain. The output is a grid showing which agent may fetch which path. Python's parser applies rules in file order and may differ from Google-style longest-match handling, so for files that mix Allow and Disallow in one group, treat the result as a first check and confirm with the vendor's own tester where one exists.
Then check the layers the parser cannot see:
- Fetch a key page with a plain request that does not run JavaScript, for example
curl -s https://example.com/docs/page, and confirm the answer text is in the output. - Request the page with a crawler's user-agent string, for example
curl -sI -A "GPTBot" https://example.com/docs/page, and confirm the status is 200, not 403 or 429. Note that this only tests your server's treatment of the string. Vendors may also publish IP ranges that your firewall checks. - Read your server logs for the tokens you care about. Logs show whether a bot actually visits, how often, and what status codes it receives.
- Check page source and response headers for
noindexorX-Robots-Tag.
Common mistakes
- Blocking everything with
User-agent: *andDisallow: /during a site migration, then forgetting to remove it. - Assuming the
*group applies to named bots. It does not once a bot has its own group. - Disallowing a path prefix too broadly, such as
Disallow: /pwhen you meant/private/. - Relying on robots.txt for secrecy. The file is public, so listing a secret path advertises it.
- Forgetting subdomains. Each host (
docs.example.com,www.example.com) serves its own robots.txt. - Never rechecking. Vendor tokens and your own site structure both change, so review the file when either does.
Exercise
Your robots.txt contains the groups below. A bot with the token ExampleBot requests /admin/settings. Can it fetch the page, and what is the simplest fix if you want it blocked? User-agent: ExampleBot Allow: / User-agent: * Disallow: /admin/
Show answer
Yes, it can fetch the page. ExampleBot has its own group, so it follows only that group and never reads the * group, and Allow: / permits every path. To block it, add Disallow: /admin/ to the ExampleBot group, and also protect /admin/ with authentication because robots.txt is only a request.
Exercise
A site allows OAI-SearchBot in robots.txt, yet the team sees no visits from it in the server logs and its pages never appear as citations. Name three non-robots.txt causes you would check.
Show answer
Any three of these: a firewall, CDN or bot-protection rule returning 403, 429 or a CAPTCHA to the bot; the answer text being rendered only by JavaScript so the fetched HTML looks empty; a noindex meta tag or X-Robots-Tag header on the pages; the content sitting behind a login or paywall; robots.txt itself returning a server error; or redirect chains that cause the bot to give up.