# Advanced robots.txt Directives: Rules, AI Bots, Mistakes

> Robots.txt wildcards, Allow/Disallow precedence, the crawl-delay myth, AI crawler controls like GPTBot and ClaudeBot, and mistakes that deindex sites.

Source: https://ranklocaltoday.com/blog/robots-txt-advanced-directives  
Last updated: 2026-10-06

Technical SEO

# Advanced robots.txt Directives: Wildcards, AI Crawlers and the Mistakes That Deindex Sites

How crawlers really match rules, why crawl-delay does little, how to handle AI bots, and how to test your file before one stray slash costs you traffic.

By **RankLocalToday** Updated Oct 6, 2026 11 min read

For: Local service business owners, marketers and developers who manage their own website and want precise control over how search engines and AI crawlers access it.

**500 KiB** Size Google reads before ignoring the rest of the file

**0** Googlebot support for crawl-delay

**1** Longest matching rule decides Allow vs Disallow conflicts

**4** Common AI tokens to decide on: GPTBot, ClaudeBot, Google-Extended, CCBot

A robots.txt file is a plain text file with a handful of directives, and it is responsible for more accidental traffic disasters than almost any other file on a website. One stray slash can tell every search engine to stop crawling your entire site. One misunderstood rule can leave private URLs sitting in search results.

This guide goes past the basics. It covers how crawlers actually match rules, how wildcards and the end-of-URL anchor behave, how Allow and Disallow conflicts are resolved, why crawl-delay does less than people think, how to handle AI crawlers such as GPTBot, ClaudeBot, Google-Extended and CCBot, what robots.txt cannot do compared with noindex, and how to test the file before it goes live. Every snippet here is something you can adapt for a local service business site.

**Best use case:** Crawler names and policies change, so confirm current user-agent tokens in each vendor's documentation before editing your live file.

## How crawlers actually read your robots.txt

The file must live at the root of the host it governs: `https://example.com/robots.txt`. Rules do not cascade across hosts, so `blog.example.com` needs its own file, and a robots.txt in a subdirectory is ignored.

Inside the file, rules are organized into groups. Each group starts with one or more `User-agent` lines and is followed by the `Allow` and `Disallow` rules that apply to those agents. The detail that trips people up is group selection: a crawler follows the single most specific group that matches its name and ignores the rest, including the wildcard group.

```
User-agent: *
Disallow: /internal-search/
Disallow: /thank-you/

User-agent: Googlebot
Disallow: /drafts/
```

In this file, Googlebot obeys only the second group. It is free to crawl `/internal-search/` and `/thank-you/`, because the rules in the `*` group do not apply to it. If you add a bot-specific group, repeat every rule that bot should still follow.

A few other mechanics matter. Directive names are case-insensitive, but the paths you write are case-sensitive, so `/Admin/` does not block `/admin/`. Lines beginning with `#` are comments. Google reads only the first 500 KiB of the file and ignores anything beyond that, which only bites very large sites. Finally, the file is a request, not a lock. Scrapers ignore it, so never use it to hide anything sensitive.

## Wildcards and pattern matching

The original robots exclusion standard matched only simple path prefixes. Major engines, including Google and Bing, now support two pattern characters that make the file far more precise. The asterisk `*` matches any sequence of characters, and the dollar sign `$` anchors a pattern to the end of the URL.

```
# Block every URL with a sort parameter
Disallow: /*?sort=

# Block any URL containing a session ID parameter
Disallow: /*sessionid=

# Block PDFs only (the $ stops it matching /pdf-guides/)
Disallow: /*.pdf$

# Block a folder but not a page that merely starts the same way
Disallow: /staging/
```

Remember that every Disallow value is treated as a prefix. `Disallow: /service` blocks `/services/`, `/service-areas/`, `/service-guide.html`, and anything else that begins with those characters. When you mean a folder, write the trailing slash: `Disallow: /tools` also blocks `/tools-and-resources`.

Wildcards suit the parameter clutter that eats crawl budget on larger sites: filters, sort orders, internal search results and booking widgets that spin out endless URLs. A 40-page plumber site rarely needs them; a multi-location franchise with thousands of generated URLs often does.

Avoid `Disallow: /*?`. It blocks every URL with a query string, including legitimate paginated pages on some CMS setups. Match the specific parameter instead.

## Allow versus Disallow: which rule wins

When more than one rule matches a URL, Google does not read top to bottom and stop at the first hit. It applies the most specific rule, defined as the one with the longest matching path. If an Allow and a Disallow match with equal specificity, Google resolves the conflict in favor of the less restrictive rule, which is Allow. Order in the file is irrelevant to Google. Some older parsers use first-match-wins, so keep rules unambiguous when you can.

The classic use is carving an exception out of a blocked folder. WordPress sites do this constantly:

```
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
```

For `/wp-admin/admin-ajax.php`, the longer Allow path wins, so front-end features keep working, while `/wp-admin/options.php` stays blocked.

Here is a trickier case that shows why specificity is counted in characters:

```
User-agent: *
Disallow: /locations/
Allow: /locations/austin/
```

Everything under `/locations/` is blocked except the Austin folder, because `/locations/austin/` is the longer match. Wildcard characters count toward length, which makes layered rules error-prone, so verify each sample URL with a parser before shipping.

## The crawl-delay myth

Crawl-delay is probably the most copied and least useful line in robots.txt. It looks like this:

```
User-agent: *
Crawl-delay: 10
```

Google does not support the directive. Googlebot ignores it completely, so adding it does nothing to slow Google down. Bing and some other crawlers read it, but a large value can throttle discovery of new pages. A 10-second delay means at most about 8,600 fetches per day from a compliant crawler.

If a crawler is genuinely overloading your server, the better tools are server-side. Confirm in your logs that the traffic is really the claimed bot, since fake user agents are common, then rate-limit at the firewall or CDN. Google documents that returning 500, 503 or 429 status codes temporarily signals crawlers to slow down.

For a typical small business site, crawl budget is not the problem and crawl-delay is not the answer. Delete it unless you have a specific, logged reason to throttle Bing or another named bot, and in that case scope it to that bot's own group.

## Controlling AI crawlers: GPTBot, ClaudeBot, Google-Extended and CCBot

Robots.txt is now also where you express your policy toward AI companies, and the landscape is more nuanced than "block AI" or "allow AI." Training crawlers collect content to build models, search crawlers fetch pages so an AI product can cite them, and user-triggered agents fetch one page because a person asked. Vendors publish separate tokens for each job, and the names change. A related, optional file is covered in our [llms.txt guide for local service businesses](https://ranklocaltoday.com/blog/llms-txt-implementation-guide).

- **GPTBot** is OpenAI's crawler for collecting training data. OpenAI uses separate tokens for its search crawler (OAI-SearchBot) and for user-initiated fetches (ChatGPT-User).
- **ClaudeBot** is Anthropic's training crawler, with separate agents documented for search and user-directed fetching.
- **Google-Extended** is not a crawler. It is a control token that tells Google whether content it has already crawled with Googlebot may be used for Gemini model training and grounding. Blocking it does not change how you rank in Google Search.
- **CCBot** is the Common Crawl crawler. Common Crawl publishes an open dataset that many AI developers use, so blocking it reduces your appearance in downstream corpora.

A policy that blocks training but stays discoverable for AI answers looks like this:

```
# Opt out of model training
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
User-agent: Google-Extended
Disallow: /

# Stay eligible to be cited in AI search answers
User-agent: OAI-SearchBot
User-agent: ChatGPT-User
Allow: /
```

Be aware of two limits. First, blocking Google-Extended does not opt you out of AI Overviews or AI Mode, which draw on pages Googlebot indexes; controlling snippet use there is done with preview directives such as `nosnippet` or `max-snippet`, with real tradeoffs for regular search results. Second, compliance is voluntary, and the file only affects future crawls, not data already collected.

The strategic question for a local business is whether you want to be recommended by AI assistants. If a prospect asks an assistant for the best roofer in your city, and the answer engines cannot read your site, you are less likely to appear. To see how answer engines currently treat your pages, run your site through our [AEO check](https://ranklocaltoday.com/aeo-check) before deciding what to block.

## Sitemap directives, and what robots.txt does not do

The Sitemap directive tells crawlers where your XML sitemaps live. It must use a fully qualified URL, it can appear anywhere in the file, and it is independent of user-agent groups, so it applies no matter which group sits above it. You can list as many as you need:

```
Sitemap: https://www.example.com/sitemap-index.xml
Sitemap: https://www.example.com/sitemap-blog.xml
```

Do not list sitemaps full of URLs you simultaneously block with Disallow; that sends contradictory signals.

Now the part that causes real damage when misunderstood. **Robots.txt controls crawling, not indexing.** If you disallow a URL but other sites link to it, Google can still index the bare URL, often showing it with no description.

The correct tool for keeping a page out of the index is a noindex directive, delivered either in the HTML or in an HTTP header:

```
<meta name="robots" content="noindex">

X-Robots-Tag: noindex
```

This leads to the single most important rule in this article: **a crawler can only obey noindex if it is allowed to fetch the page.** If you block a URL in robots.txt and also add noindex to it, Google never sees the noindex and the URL can stay indexed. To remove a page from search results, first allow crawling and serve noindex, wait until the page has dropped out, and only then consider blocking it, if there is any reason to. For content that must be genuinely private, use authentication. Neither robots.txt nor noindex is a security mechanism.

Here is a quick reference for choosing the right control:

- Stop crawlers wasting time on parameter or search URLs: robots.txt Disallow.
- Keep a page out of search results: noindex, with crawling allowed.
- Consolidate duplicate versions: canonical tags or redirects.
- Protect private content: password protection or login.

## Dangerous mistakes that deindex sites

Most robots.txt incidents are not subtle. They are the same handful of errors, repeated across industries.

**The leaked staging file.** Development and staging environments often carry a blanket block so they do not get indexed. When the site is pushed to production, the file goes with it:

```
User-agent: *
Disallow: /
```

That two-line file tells every compliant crawler to stay away from the whole site. Rankings decay over days or weeks, so the problem is often noticed late. Add a launch checklist item that opens the live file, and consider a pipeline check that fails the build if production serves a global Disallow.

**Blocking CSS and JavaScript.** Older advice said to block `/wp-content/` or `/assets/`. Google renders pages like a browser and may misjudge layout and JavaScript content without them.

**Blocking pages you want to rank by accident.** A rule like `Disallow: /blog` written to hide `/blog-drafts/` also kills `/blog/`. Prefix matching bites hardest on short paths.

**Server errors on the file itself.** A robots.txt that returns a 404 or other 4xx error is generally treated as if no restrictions exist. A persistent 5xx error is riskier: Google can treat the site as fully disallowed for a period while the file is unreachable. Make sure your CDN, firewall, or security plugin never serves an error page or a login wall at `/robots.txt`, and that the file returns a plain 200 with `text/plain`.

**Trusting a plugin blindly.** A CMS "discourage search engines" checkbox can silently rewrite your file, so re-check it after any update or migration. For a second set of eyes, our [website SEO audit](https://ranklocaltoday.com/website-seo-audit) flags blocked resources and indexing conflicts alongside the rest of your technical setup.

## Testing and validating before you ship

**1. Draft against a URL list.** Collect 15 to 30 real URLs, such as key service pages, a blog post, a parameter URL, a thank-you page and an admin path, and note whether each should be crawlable.

**2. Run a parser.** Google maintains an open-source robots.txt parser, and several community tools wrap it so you can paste a draft and check URLs without touching production. Test with the Googlebot user agent and at least one other bot, since group selection differs by agent.

**3. Verify the live file.** After deploying, request it directly and confirm the status code and content type:

```
curl -I https://www.example.com/robots.txt
curl -s https://www.example.com/robots.txt | head -50
```

**4. Use Search Console.** The robots.txt report in Google Search Console shows which version Google last fetched, when it fetched it, and any parsing errors or warnings. The URL Inspection tool tells you whether a specific URL is blocked by robots.txt and whether it is indexed. After an urgent edit you can request a recrawl from the report.

**5. Monitor.** Watch the Pages indexing report for a rise in "Blocked by robots.txt" or "Indexed, though blocked by robots.txt" statuses. The second one is the telltale sign of the crawl-versus-index confusion described earlier. Keep the file in version control so a bad deploy can be rolled back in minutes.

Done well, robots.txt stays boring: short, reviewed, and versioned. For the surrounding technical controls, browse the rest of our [technical SEO guides](https://ranklocaltoday.com/blog).

## FAQ

### Does Google respect the crawl-delay directive in robots.txt?

No. Googlebot ignores crawl-delay entirely, so adding it will not slow Google down. Bing and a few other crawlers read it, but its interpretation varies. If a bot is genuinely overloading your server, verify it in your logs and rate-limit at the server, CDN or firewall level, or return temporary 429 or 503 responses.

### If I block a page in robots.txt, will it disappear from Google?

Not reliably. Robots.txt stops crawling, not indexing, so a blocked URL that other sites link to can still appear in results with no description. To remove a page, allow crawling and serve a noindex meta tag or X-Robots-Tag header, wait for it to drop out, and only then decide whether blocking is still useful.

### Should a local business block GPTBot and ClaudeBot?

It depends on your goals. Blocking GPTBot, ClaudeBot, CCBot and Google-Extended opts you out of model training, but it does not remove you from Google Search. Many local businesses block training crawlers while allowing search and retrieval agents, so assistants can still cite and recommend them in answers.

### What happens when an Allow and a Disallow rule conflict?

Google applies the rule with the longest matching path, because it is the most specific. If both rules match with equal length, the less restrictive Allow wins. File order does not matter to Google, though some older parsers use first-match-wins, so test any layered rules against real sample URLs before publishing.

### How do I know if my robots.txt is accidentally blocking my site?

Open yoursite.com/robots.txt and look for a bare Disallow: / under User-agent: *. Then check the robots.txt report and URL Inspection in Search Console, and watch the Pages report for blocked URLs. A launch checklist that re-verifies the file after every deployment or migration catches most disasters early.

### Turn this into a practical SEO action plan

Use RankLocalToday tools to check rankings, diagnose website issues, and prioritize the next organic traffic move.

[Get your SEO plan →](https://ranklocaltoday.com/local-seo-plan)

More in this topic: [Local SEO strategy, all 165 guides →](https://ranklocaltoday.com/blog/local-seo-strategy-guides)
