# Configure robots.txt to match these goals

- Check 31.03 · AI crawler access and data policy · Critical
- Source: https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/configure-robotstxt-match-these-goals
- Write a robots.txt that applies your AI crawler policy and publish it on Apache, Nginx, Cloudflare, WordPress, Shopify, Next.js and other platforms.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/configure-robotstxt-match-these-goals.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

The robots.txt file is where your AI crawler policy becomes machine-readable. This guide provides three complete files (open everything; search yes, training no; refuse everything) and shows where the file is edited on each server, CMS and framework. Once this check is done, `https://example.com/robots.txt` responds with a 200 and rules that match exactly the matrix you settled on.

## Why it matters

Before crawling a site, a well-behaved crawler downloads `/robots.txt`, looks for the group of rules bearing its name, and complies with it. OpenAI, Anthropic, Perplexity, Google and Microsoft each document the tokens to use to control search and training separately.

Three mechanisms explain most incidents:

- **A crawler applies only one group.** If there is a group with its name, it ignores the `User-agent: *` group. Rules do not add up.
- **The file applies to one host and one protocol.** `https://example.com/robots.txt` says nothing about `https://blog.example.com/`.
- **Changes are not instantaneous.** OpenAI mentions about 24 hours for its search systems to adjust, Perplexity up to 24 hours, and Google generally caches the file for up to 24 hours.

The file remains a convention. It blocks nothing technically, it is public, and user-triggered crawlers (ChatGPT-User, Perplexity-User) may not apply it. It is not a security control: private content is [protected by authentication](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/protect-private-content-authentication).

## What it improves

- **Crawling by generative engines**: the AI search crawlers you target are no longer refused by an inherited or overly broad rule.
- **Content use**: the refusal of training is expressed with the tokens each vendor recognizes.
- **Citations in AI answers**: indirect effect. An allowed crawler can index the page; no rule guarantees it will be cited.
- **Server load**: crawlers that respect the file stop crawling the forbidden sections.
- **Readability of the policy**: a commented file states plainly what is allowed, to your teams as well as to third parties.

## How to check

First check that the file is served correctly:

```bash
curl -s -o /dev/null -w "%{http_code} %{content_type}\n" https://example.com/robots.txt
```

Compliant result: `200 text/plain`. A 5xx error is the most serious case: Google then suspends crawling of the site for as long as it lasts. An HTML page returned with a 200 instead of the file makes the rules unreadable.

Then read what each crawler is allowed to do. This script relies on the parser in Python's standard library:

```bash
python3 - <<'EOF'
from urllib.robotparser import RobotFileParser

parser = RobotFileParser("https://example.com/robots.txt")
parser.read()
robots = ["Googlebot", "bingbot", "OAI-SearchBot", "PerplexityBot", "Claude-SearchBot",
          "GPTBot", "ClaudeBot", "Google-Extended", "ChatGPT-User"]
for robot in robots:
    verdict = "allowed" if parser.can_fetch(robot, "https://example.com/") else "refused"
    print(f"{robot:18} {verdict}")
EOF
```

Compare the output with your matrix. Python's parser settles conflicts between `Allow` and `Disallow` less precisely than Google: for a disputed case, use the robots.txt report in Google Search Console ([`Settings > robots.txt`](https://search.google.com/search-console/settings/robots-txt)) or the testing tool in Bing Webmaster Tools.

Finally, test each subdomain and each language version: see [check AI crawler access on all versions](https://checklist-seo-geo.com/en/multilingual-geo-international-reputation/check-ai-crawler-access-all-versions).

## How to implement

### Before you start

Choose the file that matches the policy resulting from [defining rules for each family](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/define-rules-search-training-user-triggered-access). Replace `example.com` and the directories (`/admin/`, `/compte/`, `/panier/`) with your own.

**Policy 1 — Open everything.** No AI crawler needs to be named: they all follow the general group.

```txt
# Policy: search, training and user-triggered access allowed
User-agent: *
Disallow: /admin/
Disallow: /compte/
Disallow: /panier/

Sitemap: https://example.com/sitemap.xml
```

**Policy 2 — Search yes, training no.** Search crawlers (Googlebot, Bingbot, OAI-SearchBot, PerplexityBot, Claude-SearchBot) follow the general group. Training crawlers and tokens are refused.

```txt
# Policy: search and user-triggered access allowed, training refused
User-agent: *
Disallow: /admin/
Disallow: /compte/
Disallow: /panier/

# Model training: refused
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: Applebot-Extended
User-agent: CCBot
User-agent: meta-externalagent
User-agent: Bytespider
Disallow: /

Sitemap: https://example.com/sitemap.xml
```

**Policy 3 — Refuse everything to AI crawlers.** Traditional search stays open.

```txt
# Policy: AI crawlers refused (search, training, user-triggered access)
User-agent: *
Disallow: /admin/
Disallow: /compte/
Disallow: /panier/

User-agent: OAI-SearchBot
User-agent: GPTBot
User-agent: ChatGPT-User
User-agent: Claude-SearchBot
User-agent: ClaudeBot
User-agent: Claude-User
User-agent: PerplexityBot
User-agent: Perplexity-User
User-agent: Google-Extended
User-agent: Applebot-Extended
User-agent: CCBot
User-agent: meta-externalagent
User-agent: Bytespider
Disallow: /

Sitemap: https://example.com/sitemap.xml
```

This third policy removes you neither from Google's AI Overviews nor from Copilot, which rely on Googlebot and Bingbot: those surfaces are controlled elsewhere, see [check Googlebot and Bingbot](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/check-googlebot-bingbot). According to Google's documentation, `Google-Extended` also governs the grounding of answers in the Gemini app: refusing it therefore costs visibility in Gemini, not in Google Search.

> **Warning:** if you create a group with a crawler's name, copy the general group's restrictions into it. A `User-agent: OAI-SearchBot` group reduced to `Allow: /` opens `/admin/` to that crawler, since it no longer reads the `*` group.

### Apache

Versions: Apache 2.4.

Put the file at the root of the site, in the virtual host's `DocumentRoot` (for example `/var/www/example/public/robots.txt`). No reload is needed. Check that no rewrite rule in `.htaccess` sends `/robots.txt` to the application: the `RewriteCond %{REQUEST_FILENAME} !-f` condition, present in most configurations, prevents this.

### Nginx

Versions: Nginx 1.18 and later.

Same principle: the file goes in the `root` directory of the `server` block. If all requests go to an application, add a dedicated location:

```nginx
location = /robots.txt {
    root /var/www/example/public;
    default_type text/plain;
    try_files $uri =404;
}
```

```bash
sudo nginx -t && sudo systemctl reload nginx
```

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

Cloudflare is a CDN (Content Delivery Network) placed in front of your server: it can modify the file crawlers see, without touching the origin. In [`Security > Settings`](https://dash.cloudflare.com/?to=/:account/:zone/security/settings), filter on `Bot traffic` and open `AI Crawler and Agent access policies`. By setting the `Training` policy to `Disallow` and enabling `Bot Preference Sync`, Cloudflare adds a managed block at the top of your robots.txt: a `Content-Signal` line and `Disallow` rules for a list of training crawlers (including GPTBot, ClaudeBot, Google-Extended and CCBot). If there is no file at the origin, Cloudflare creates one. Available on all plans.

Consequence: the file served is no longer your server's. Always check the public URL, and turn this option off if you prefer to manage the rules yourself. After editing the file at the origin, purge `https://example.com/robots.txt` in [`Caching > Configuration > Custom Purge`](https://dash.cloudflare.com/?to=/:account/:zone/caching/configuration). Settings that actually block requests are covered in [check CDN, Cloudflare and WAF](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/check-cdn-cloudflare-waf).

### AWS

Versions: Amazon S3 and CloudFront, AWS CLI v2, November 2026.

On a static **S3** site behind **CloudFront**, upload the file to the root of the bucket with the right type, then invalidate the cache:

```bash
aws s3 cp robots.txt s3://BUCKET_NAME/robots.txt --content-type "text/plain; charset=utf-8"
aws cloudfront create-invalidation --distribution-id DISTRIBUTION_ID --paths "/robots.txt"
```

Behind an Application Load Balancer, the file is served by the instances: follow the Apache or Nginx section.

### Plesk

Versions: Plesk Obsidian 18.0.

`Websites & Domains > your domain > Files`, open the `httpdocs` folder and create or edit `robots.txt` with the built-in editor.

### cPanel

Versions: cPanel & WHM 134 to 138 (Jupiter theme).

`Files > File Manager`, `public_html` folder (or the addon domain's root), then `Edit` on `robots.txt`.

### Shared hosting

Upload the file over SFTP to the web root: `www/` at OVHcloud, `public_html/` at o2switch, Hostinger or Infomaniak depending on the configuration. If a CMS already generates a robots.txt, first read the section that concerns it: a physical file takes precedence over the generated one.

### Vercel

Versions: Vercel dashboard, all plans, November 2026.

Put `robots.txt` in the project's `public/` folder, or generate it through the framework (see Next.js, Nuxt). It is published with the next deployment.

### Netlify

Versions: Netlify, all plans, November 2026.

Put the file in the publish directory (`public/`, `static/` or `dist/` depending on the generator) and redeploy.

### WordPress

Versions: WordPress 6.7 to 7.1 (`robots_txt` filter available since 3.0), Yoast SEO 21.5 and later, Rank Math 1.0.

Without a physical file, WordPress generates a virtual robots.txt (`Disallow: /wp-admin/`, `Allow: /wp-admin/admin-ajax.php`, a `Sitemap` line). Three ways to change it:

- **Yoast SEO**: [`Yoast SEO > Tools > File editor`](https://yoast.com/help/how-to-edit-robots-txt-through-yoast-seo/). The tool creates a physical file that you edit in the admin. Yoast SEO Premium also offers, under `Settings > Advanced > Crawl optimization`, toggles that add lines blocking certain AI crawlers (GPTBot, CCBot, Google-Extended): check that they match your policy.
- **Rank Math**: [`Rank Math SEO > General Settings > Edit robots.txt`](https://rankmath.com/kb/how-to-edit-robots-txt-with-rank-math/) (advanced mode). The editor is disabled if a physical file exists at the root: delete it over SFTP first.
- **Without a plugin**: upload a physical file over SFTP, or extend the virtual file in a custom plugin:

```php
add_filter('robots_txt', function (string $output, bool $public): string {
    $rules = [
        'User-agent: GPTBot',
        'User-agent: ClaudeBot',
        'User-agent: Google-Extended',
        'User-agent: Applebot-Extended',
        'User-agent: CCBot',
        'Disallow: /',
    ];

    $block = implode("\n", $rules);

    return "{$output}\n{$block}\n";
}, 10, 2);
```

Then clear the page cache and the CDN cache. Some managed WordPress hosts and some security plugins add their own lines: reread the public file after each installation.

### Shopify

Versions: Shopify, all plans (Online Store 2.0 and earlier themes), November 2026.

Shopify generates the file. To customize it: `Online Store > Themes`, the theme's `…` menu, `Edit code`, then `Add a new template`, type `robots`, and `Create template`: Shopify creates `templates/robots.txt.liquid`. Keep the default rules and add yours after them:

```liquid
{% for group in robots.default_groups %}
  {{- group.user_agent }}

  {%- for rule in group.rules -%}
    {{ rule }}
  {%- endfor -%}

  {%- if group.sitemap != blank -%}
    {{ group.sitemap }}
  {%- endif -%}
{% endfor %}

User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: CCBot
Disallow: /
```

Save a copy of `/robots.txt` before the change and compare afterwards: this template replaces the output generated by Shopify.

### PrestaShop

Versions: PrestaShop 8 and 9.

`Shop Parameters > Traffic & SEO`, button to generate the robots.txt file. This generation overwrites the existing file: add your AI crawler groups by hand to the `robots.txt` at the store's root, and do it again after each regeneration.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4 (checked on 2.4.9).

`Content > Design > Configuration`, edit the relevant view, `Search Engine Robots` section, custom instructions field. Flush the cache after saving.

### Drupal

Versions: Drupal 10 and 11, RobotsTxt module 8.x-1.6.

The file is at the web root (`web/robots.txt`). Core updates through Composer rewrite it: exclude it from scaffolding in `composer.json`. To edit it in the admin, install the RobotsTxt module: it requires deleting `web/robots.txt`, and the exclusion below keeps Composer from recreating it.

```json
{
    "extra": {
        "drupal-scaffold": {
            "file-mapping": {
                "[web-root]/robots.txt": false
            }
        }
    }
}
```

### Wix

Versions: Wix dashboard, all plans, November 2026.

In the site's dashboard: [`SEO & GEO > Tools and settings > Robots.txt Editor`](https://support.wix.com/en/article/editing-your-sites-robotstxt-file), then `View File`. Add your groups and save.

### Squarespace

Versions: Squarespace 7.1, all plans, November 2026.

The file cannot be edited directly. The `Settings > Crawlers` panel offers separate toggles for search engine crawlers and for artificial intelligence crawlers. The list of crawlers concerned is set by Squarespace: read the public robots.txt after each change to know what is actually refused.

### Webflow

Versions: Webflow, Site plan or paid Workspace, November 2026.

`Site settings > SEO`, indexing section, `robots.txt` field. Paste your rules, save and republish the site.

### Laravel

Versions: Laravel 11 to 13.

By default, Laravel serves the static `public/robots.txt` file: edit it. For different rules in production and staging, delete this file (otherwise the web server serves it first) and declare a route:

```php
<?php

// routes/web.php
use App\Http\Controllers\RobotsController;
use Illuminate\Support\Facades\Route;

Route::get('/robots.txt', [RobotsController::class, 'show'])->name('robots');
```

```php
<?php

// app/Http/Controllers/RobotsController.php
namespace App\Http\Controllers;

use Illuminate\Http\Response;

class RobotsController extends Controller
{
    public function show(): Response
    {
        $view = app()->isProduction() ? 'robots.production' : 'robots.staging';

        return response()
            ->view($view)
            ->header('Content-Type', 'text/plain; charset=UTF-8');
    }
}
```

Create `resources/views/robots/production.blade.php` with the chosen policy and `staging.blade.php` with `User-agent: *` followed by `Disallow: /`.

### Next.js

Versions: Next.js 15 and 16 (App Router and Pages Router).

#### App Router

Create `app/robots.ts`: Next.js generates the file.

```ts
// app/robots.ts
import type { MetadataRoute } from 'next'

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      {
        userAgent: '*',
        disallow: ['/admin/', '/compte/', '/panier/'],
      },
      {
        userAgent: ['GPTBot', 'ClaudeBot', 'Google-Extended', 'Applebot-Extended', 'CCBot', 'meta-externalagent', 'Bytespider'],
        disallow: ['/'],
      },
    ],
    sitemap: 'https://example.com/sitemap.xml',
  }
}
```

A static `app/robots.txt` or `public/robots.txt` file also works, but not alongside `app/robots.ts`.

#### Pages Router

The `robots.ts` convention does not exist in the `pages/` folder. The simplest option is a static `public/robots.txt` file. To generate it, create an API route and rewrite `/robots.txt` to it, with no `public/robots.txt` file (it would be served before the rewrite):

```ts
// pages/api/robots.ts
import type { NextApiRequest, NextApiResponse } from 'next'

const rules = [
  'User-agent: *',
  'Disallow: /admin/',
  'Disallow: /compte/',
  'Disallow: /panier/',
  '',
  'User-agent: GPTBot',
  'User-agent: ClaudeBot',
  'User-agent: Google-Extended',
  'User-agent: Applebot-Extended',
  'User-agent: CCBot',
  'Disallow: /',
  '',
  'Sitemap: https://example.com/sitemap.xml',
]

export default function handler(req: NextApiRequest, res: NextApiResponse) {
  res.setHeader('Content-Type', 'text/plain; charset=utf-8')
  res.send(`${rules.join('\n')}\n`)
}
```

```ts
// next.config.ts
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  async rewrites() {
    return [{ source: '/robots.txt', destination: '/api/robots' }]
  },
}

export default nextConfig
```

### Nuxt

Versions: Nuxt 4, `@nuxtjs/robots` module 7 (requires Nuxt 4.6 or later).

The simplest option is a static `public/robots.txt` file. To generate it, install the `@nuxtjs/robots` module (`npx nuxt module add robots`):

```ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/robots'],
  robots: {
    groups: [
      { userAgent: ['*'], disallow: ['/admin/', '/compte/', '/panier/'] },
      {
        userAgent: ['GPTBot', 'ClaudeBot', 'Google-Extended', 'Applebot-Extended', 'CCBot', 'meta-externalagent', 'Bytespider'],
        disallow: ['/'],
      },
    ],
    sitemap: ['https://example.com/sitemap.xml'],
  },
})
```

On Nuxt 3, end of life since July 2026, stay on version 6 of the module: the configuration is the same.

## Common mistakes

- **Naming a crawler without copying the general rules**: the named group replaces the `*` group, it does not add to it.
- **Blocking AI search crawlers with an “anti-AI” list**: reread each token; `OAI-SearchBot`, `PerplexityBot` and `Claude-SearchBot` have no place in a training refusal.
- **Leaving the staging `Disallow: /` in place**: after going live, this is the most common cause of an invisible site. See [monitor robots.txt and noindex](https://checklist-seo-geo.com/en/automation-quality-control/monitor-robotstxt-noindex).
- **Forgetting subdomains**: each host has its own file.
- **Relying on robots.txt against a crawler that ignores it**: a firm block is done at the firewall.
- **Using `Disallow` to deindex**: a page that cannot be crawled may remain known by its URL. Deindexing goes through `noindex`, which the crawler must be able to read.
- **Two sources of truth**: a physical file, a file generated by the CMS and a block added by the CDN. Only the public URL counts.

## Frequently asked questions

### What robots.txt should I write to refuse AI training without losing search?

To refuse training without losing search, name the training crawlers and tokens (GPTBot, ClaudeBot, Google-Extended, Applebot-Extended, CCBot) in robots.txt in a group ending with `Disallow: /`, and let search crawlers follow the general group. OAI-SearchBot, PerplexityBot and Claude-SearchBot must not appear in this refusal. Then reread the file actually served and test each crawler.

### Is robots.txt enough to stop AI from using my content?

No, robots.txt is a convention that crawlers choose to respect, not a security control. The file is public, it blocks nothing technically, and user-triggered crawlers such as ChatGPT-User or Perplexity-User may not apply it. A firm refusal is done at the firewall, and genuinely private content must be protected by authentication.

### How long does a robots.txt change take to be applied?

A robots.txt change is not instantaneous. OpenAI mentions about 24 hours for its search systems to adjust, Perplexity up to 24 hours, and Google generally caches the file for up to 24 hours. Behind a CDN, also purge the file's URL, otherwise the cache may keep serving the old version to crawlers.

### Do I need a robots.txt for each subdomain?

Yes, a robots.txt applies only to the host and protocol that serve it. The `https://example.com/robots.txt` file says nothing about `https://blog.example.com/`, which must publish its own at its own root. A forgotten subdomain therefore does not apply your AI crawler policy, even if the main domain is perfectly configured.

## Resources

- [RFC 9309: Robots Exclusion Protocol](https://www.rfc-editor.org/rfc/rfc9309.html)
- [Google: How Google interprets the robots.txt specification](https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt)
- [OpenAI: robots.txt tokens for OpenAI crawlers](https://developers.openai.com/api/docs/bots)
- [Anthropic: blocking or allowing Anthropic's crawlers](https://support.claude.com/en/articles/8896518)
- [Perplexity: Perplexity robots.txt tokens](https://docs.perplexity.ai/docs/resources/perplexity-crawlers)
- [Cloudflare: Managed robots.txt](https://developers.cloudflare.com/bots/additional-configurations/managed-robots-txt/)
- [Shopify: robots.txt.liquid template](https://shopify.dev/docs/storefronts/themes/architecture/templates/robots-txt-liquid)
- [Next.js: robots file](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots)
- [Nuxt Robots: configuration](https://nuxtseo.com/docs/robots/guides/nuxt-config)

Next steps: [test HTTP responses for each crawler](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/test-http-responses-each-crawler), [check robots.txt access and syntax](https://checklist-seo-geo.com/en/crawling/check-robotstxt-access-syntax) and [declare sitemaps in robots.txt](https://checklist-seo-geo.com/en/crawling/declare-sitemaps-robotstxt).
