# Monitor robots.txt and noindex

- Check 46.03 · Automation and quality control · Complementary
- Source: https://checklist-seo-geo.com/en/automation-quality-control/monitor-robotstxt-noindex
- Automatically detect a robots.txt change, a Disallow: / or a noindex that appears on your key pages: script, scheduled crawl, Search Console and CMS.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/automation-quality-control/monitor-robotstxt-noindex.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

robots.txt decides what crawlers are allowed to crawl; noindex directives, in a meta tag or an `X-Robots-Tag` header, decide what can be indexed. A single changed line in either one can remove an entire site from search results and from AI assistants' answers. Monitoring means comparing robots.txt with a reference version every day and checking that the pages that should be indexed carry no noindex, with an alert at the slightest deviation.

## Why it matters

These two settings rarely break through malice, almost always by accident:

- the staging robots.txt (`Disallow: /`) goes to production along with the rest of the code;
- the “Discourage search engines from indexing this site” box stays checked after a WordPress site goes live;
- an `X-Robots-Tag: noindex` header, set on the test server, is copied along with the configuration;
- an updated SEO plugin changes its default settings for a content type;
- a third-party service rewrites the file: Cloudflare, for example, can add its own directives at the top of robots.txt when you turn on its AI crawler management.

The consequences take time to appear but are severe. Google generally caches robots.txt for up to 24 hours, then applies the new version. A noindex is only taken into account when each page is recrawled, which spreads the drop over days or weeks and makes it hard to link to its cause. Conversely, a `Disallow` set on a page that already has a noindex prevents Google from seeing the directive: the page can remain visible in the results.

For generative engines, robots.txt is also where you allow or refuse each AI crawler. An unintended change can cut off access for OAI-SearchBot or PerplexityBot without anyone noticing.

## What it improves

- **Indexing**: an accidental block or noindex is fixed within hours, before pages drop out of the index.
- **Crawling**: the sections open to crawlers stay open after each deployment.
- **Visibility in AI assistants**: the access policy for AI crawlers remains the one you decided.
- **Traceability**: each version of robots.txt is dated, which makes it possible to link a drop to a change.
- **Rankings**: no direct effect; monitoring protects against potentially total losses.

## How to check

Three commands give the current state:

```bash
curl -s https://example.com/robots.txt
curl -sI https://example.com/ | grep -i x-robots-tag
curl -s https://example.com/ | grep -ioE '<meta[^>]+name=["'"'"']?robots[^>]*>'
```

Expected result: robots.txt returns 200 and does not contain `Disallow: /` on its own under `User-agent: *`; no `X-Robots-Tag` header containing `noindex`; no meta robots tag, or an `index, follow` tag.

In Search Console:

- the [robots.txt report](https://search.google.com/search-console/settings/robots-txt) lists the files fetched, their status and, under “Versions”, the changes over the last 30 days;
- the [Page indexing report](https://search.google.com/search-console/index), reason “Excluded by ‘noindex’ tag”, filtered on “All submitted pages”, should contain no URL from your sitemaps.

## How to implement

### Before you start

Prepare two reference files, in a dedicated folder such as `/srv/controles/robots/`:

- `robots-reference.txt`: the exact copy of the approved production robots.txt. Any intended change to robots.txt then goes through updating this copy, which makes it a deliberate act.
- `urls-indexables.txt`: one URL per line, the pages that must always be indexable. Take the homepage and one or two URLs of each template (category, product page, article, service page, local page), that is twenty to fifty URLs.

On a multilingual site or one with several subdomains, each host has its own robots.txt: plan one reference per host.

### The check script

This Bash script uses only `curl`, `awk`, `grep` and `diff`. It checks the robots.txt status code, detects a `Disallow: /` under `User-agent: *` or under an important crawler, compares the file with the reference, then checks the `X-Robots-Tag` header and meta robots tags of each URL. Save it as `/srv/controles/controle-robots.sh`:

```bash
#!/usr/bin/env bash
# Monitors robots.txt (status code, full block, changes) and noindex on indexable URLs.
set -u
SITE="${SITE:-https://example.com}"
DOSSIER="${DOSSIER:-/srv/controles/robots}"
UA="Mozilla/5.0 (compatible; controle-robots/1.0)"
ALERTES=0

alerte() {
  echo "$1"
  ALERTES=$((ALERTES + 1))
}

code=$(curl -s -o "$DOSSIER/robots-actuel.txt" -m 20 -A "$UA" -w '%{http_code}' "$SITE/robots.txt")
[ "$code" = "200" ] || alerte "ROBOTS.TXT: code $code"

bloque=$(tr -d '\r' < "$DOSSIER/robots-actuel.txt" | awk '
  tolower($1) == "user-agent:" { ua = tolower($2) }
  tolower($1) == "disallow:" && $2 == "/" && (ua == "*" || ua ~ /googlebot|bingbot|oai-searchbot/) { print ua }')
[ -z "$bloque" ] || alerte "ROBOTS.TXT: Disallow: / for $(echo $bloque)"

if ! diff -u "$DOSSIER/robots-reference.txt" "$DOSSIER/robots-actuel.txt"; then
  alerte "ROBOTS.TXT: content changed (diff above)"
fi

while read -r url || [ -n "$url" ]; do
  [ -z "$url" ] && continue
  entetes=$(curl -s -D - -o "$DOSSIER/page.html" -m 20 -A "$UA" "$url" | tr -d '\r')
  statut=$(echo "$entetes" | head -n 1 | awk '{ print $2 }')
  [ "$statut" = "200" ] || alerte "NOT 200: $url ($statut)"
  echo "$entetes" | grep -qi '^x-robots-tag:.*\(noindex\|none\)' && alerte "NOINDEX (header): $url"
  grep -ioE '<meta[^>]+>' "$DOSSIER/page.html" | grep -iE 'name=["'"'"']?(robots|googlebot|bingbot)' \
    | grep -qiE 'noindex|none' && alerte "NOINDEX (meta): $url"
done < "$DOSSIER/urls-indexables.txt"

echo "$(date '+%F %T'): $ALERTES alert(s)."
[ "$ALERTES" -eq 0 ]
```

Limits to be aware of: the script reads the initial HTML, without executing JavaScript. If your site adds the meta robots tag on the client side, also check the rendered page, see [check title, description and canonical after rendering](https://checklist-seo-geo.com/en/javascript-html-rendering/check-title-description-canonical-after-rendering). Block detection catches the most serious case, `Disallow: /`; other changes show up in the diff.

Schedule it every hour with cron (`crontab -e`) from a machine separate from the site:

```txt
10 * * * * cd /srv/controles && ./controle-robots.sh > /tmp/controle-robots.log 2>&1 || mail -s "robots.txt / noindex: alert" seo@example.com < /tmp/controle-robots.log
```

Without a server, the script runs in GitHub Actions following the model in [schedule automated crawls](https://checklist-seo-geo.com/en/automation-quality-control/schedule-automated-crawls). Also run it right after each deployment: that is when these regressions happen.

### Block the deployment upstream

The best time to catch a `Disallow: /` is before going to production. Add a test to the deployment pipeline that fails if the production robots.txt blocks everything or if a key page carries a noindex. The full approach is described in [integrate SEO, performance and accessibility tests into CI/CD](https://checklist-seo-geo.com/en/automation-quality-control/integrate-seo-performance-accessibility-tests-into-ci-cd); the Laravel and Next.js sections below give an example.

### With Search Console and Bing Webmaster Tools

- **Notifications**: check that the people in charge are listed in [Users and permissions](https://search.google.com/search-console/users); Search Console sends an email when it detects a new indexing issue.
- **robots.txt report**: check it after each change. After an urgent fix, use the “More settings” icon, then “Request a recrawl”; Google does not guarantee a timeframe.
- **Page indexing**: every week, reason “Excluded by ‘noindex’ tag” filtered on the pages submitted in the sitemap. A sudden rise is an alert.
- **Bing**: the [robots.txt tester](https://www.bing.com/webmasters/robotstxttester) in Bing Webmaster Tools checks whether a URL is accessible to bingbot.

These reports confirm the effect at Google and Bing, but several days late: they complement the script, they do not replace it. For an alert dedicated to a drop in the number of indexed pages, see [create deindexing alerts](https://checklist-seo-geo.com/en/automation-quality-control/create-deindexing-alerts).

### With a scheduled crawl or a monitoring service

- **Screaming Frog**: in a scheduled crawl, export the “Noindex” filter of the `Directives` tab and compare it with the previous run. The crawl covers every URL, not only the reference list.
- **Little Warden**: a paid service that monitors, among other things, changes to robots.txt and warns you when it changes.
- **Conductor Website Monitoring** (formerly ContentKing): continuous monitoring of pages and alerts on changes, suited to large sites.

### Apache

Versions: Apache 2.4.

Look for headers set by the configuration, often inherited from a staging environment:

```bash
grep -rn -i "x-robots-tag" /etc/apache2/ /var/www/*/.htaccess 2>/dev/null
```

A `Header set X-Robots-Tag "noindex"` in a production virtual host is almost always a mistake, unless it targets specific files (internal PDFs, feed files). On Red Hat distributions, search in `/etc/httpd/`.

### Nginx

Versions: Nginx 1.24 and later.

```bash
grep -rn -i "x-robots-tag" /etc/nginx/
```

Also check that no `location = /robots.txt` block returns hard-coded content that differs from the expected file, for example `return 200 "User-agent: *\nDisallow: /\n";` left over from a staging environment. After fixing it: `sudo nginx -t && sudo systemctl reload nginx`.

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

- **Managed robots.txt**: when an AI crawler blocking policy is active in the [security settings](https://dash.cloudflare.com/?to=/:account/:zone/security/settings) (AI crawlers and agents section), Cloudflare adds its directives at the top of your robots.txt, with a Content Signals block. Your reference must reflect the file served by Cloudflare, not the one on your server: the script queries the public URL and detects this change.
- **Transform Rules**: in the [rules overview](https://dash.cloudflare.com/?to=/:account/:zone/rules/overview), check that no response header modification rule adds `X-Robots-Tag`.
- **Cache**: after fixing robots.txt at the origin, purge it from the cache: [`Caching > Configuration`](https://dash.cloudflare.com/?to=/:account/:zone/caching/configuration), Custom Purge of the URL `https://example.com/robots.txt`.

### WordPress

Versions: WordPress 6.4 and later.

The most often forgotten setting is in `Settings > Reading`, “Search engine visibility”: the “Discourage search engines from indexing this site” box adds a noindex meta robots tag to the whole site. It corresponds to the `blog_public` option, which WP-CLI can check in a scheduled task:

```bash
#!/usr/bin/env bash
cd /var/www/example.com
if [ "$(wp option get blog_public)" != "1" ]; then
  echo "WordPress: search engine visibility is turned off"
  exit 1
fi
```

Also check your SEO plugin's indexing settings by content type and taxonomy (Yoast SEO, Rank Math) after each major update. WordPress's robots.txt is virtual as long as no `robots.txt` file exists at the root; a plugin can modify it.

### Shopify

Versions: Shopify, all plans, November 2026.

Shopify generates robots.txt. If you have customized it with the `robots.txt.liquid` template, that template replaces the default output: a theme change or an edit to the template changes the file served. Keep the reference up to date after each theme publication and monitor the public file. While a store is being prepared, password protection prevents any indexing: check that it is removed at launch.

### Laravel

Versions: Laravel 11 to 13.

A common practice sets an `X-Robots-Tag: noindex` outside production in a middleware. Protect the condition with a test that simulates the production environment, for example with Pest in `tests/Feature/IndexationTest.php`:

```php
it('keeps pages indexable in production', function () {
    app()->detectEnvironment(fn () => 'production');

    $this->get('/')
        ->assertOk()
        ->assertHeaderMissing('X-Robots-Tag')
        ->assertDontSee('noindex', false);
});

it('does not block the whole site in the production robots.txt', function () {
    app()->detectEnvironment(fn () => 'production');

    $this->get('/robots.txt')
        ->assertOk()
        ->assertDontSee("Disallow: /\n", false);
});
```

The second test assumes that robots.txt is served by a route; a static file in `public/` is not served by the test client, so check it with the script after deployment.

### Next.js

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

The `app/robots.ts` file and the `robots` property of `metadata` often depend on an environment variable. A missing or misnamed variable in production is enough to produce a `Disallow: /` or a noindex:

```ts
import type { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
  const isProduction = process.env.VERCEL_ENV === 'production' || process.env.SITE_ENV === 'production';

  return {
    rules: isProduction ? { userAgent: '*', allow: '/' } : { userAgent: '*', disallow: '/' },
    sitemap: 'https://example.com/sitemap.xml',
  };
}
```

Run the check script after each production deployment, against the public domain.

### Vercel

Versions: Vercel, all plans, November 2026.

Vercel adds an `X-Robots-Tag: noindex` header to preview deployments, but not to a preview served from a custom domain assigned to a branch. This is intentional; just check that the reference list targets the production domain, and protect staging domains with authentication (see [protect staging and private data with authentication](https://checklist-seo-geo.com/en/indexing-canonicalization/protect-staging-private-data-authentication)).

## Common mistakes

- **Copying staging to production without rereading robots.txt**: the number one cause of sites deindexed after going live.
- **Blocking in robots.txt a page you want deindexed**: Google can no longer read its noindex. Leave it crawlable until it has left the index.
- **Monitoring only the main domain's robots.txt**: each subdomain and each protocol has its own.
- **Forgetting the `X-Robots-Tag` header**: invisible in the page's source code, it only appears in the HTTP headers.
- **Updating the reference without rereading the diff**: the alert goes away, the regression stays.
- **Relying on Search Console alone**: it reports the problem several days later, when pages have already dropped out of the index.
- **Forgetting AI crawlers**: a `Disallow: /` under `User-agent: OAI-SearchBot` does not affect Google and goes unnoticed in the usual reports.

## Frequently asked questions

### How long does it take Google to see a robots.txt change?

Google generally caches robots.txt for up to 24 hours, sometimes longer when it cannot fetch a new version. A block added by mistake can therefore apply from the next day. After an urgent fix, request a recrawl of the file from the robots.txt report in Search Console: Google fetches it faster, with no guaranteed timeframe.

### How do you know whether a page has a noindex?

A noindex directive can be in two places: in a meta robots tag in the HTML, or in the X-Robots-Tag HTTP header. Check both, for example with curl or the browser's Network tab for the header. The URL Inspection tool in Search Console shows whether Google detected a noindex during its last crawl of the page.

### Is a noindex added by mistake serious?

A noindex added by mistake removes the page from Google's index at its next crawl, which can take anywhere from a few days to several weeks depending on how often the crawler visits. Removing the directive is enough to make the page indexable again, but reindexing also depends on recrawling. The faster the detection, the fewer pages are affected.

### Should you block AI crawlers in robots.txt?

Blocking AI crawlers in robots.txt is a policy choice, not an obligation. Assistants' search crawlers, such as OAI-SearchBot, are used to cite your pages in answers; training crawlers collect data for models. Decide crawler by crawler, then monitor the file so that this decision does not change by accident, for example when an option of your CDN is turned on.

## Resources

- [Google Search Central: how Google interprets robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt)
- [Google Search Central: block indexing with noindex](https://developers.google.com/search/docs/crawling-indexing/block-indexing)
- [Search Console Help: robots.txt report](https://support.google.com/webmasters/answer/6062598)
- [Cloudflare: managed robots.txt](https://developers.cloudflare.com/bots/additional-configurations/managed-robots-txt/)
- [Shopify: customize robots.txt.liquid](https://shopify.dev/docs/storefronts/themes/seo/robots-txt)
- [Next.js: the robots file](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots)
- [Vercel: indexing of preview deployments](https://vercel.com/kb/guide/are-vercel-preview-deployment-indexed-by-search-engines)

Next steps: [remove accidental noindex tags](https://checklist-seo-geo.com/en/indexing-canonicalization/remove-accidental-noindex-tags), [check robots.txt access and syntax](https://checklist-seo-geo.com/en/crawling/check-robotstxt-access-syntax) and [monitor canonicals and sitemaps](https://checklist-seo-geo.com/en/automation-quality-control/monitor-canonicals-sitemaps).
