---
title: "Robots.txt"
description: "Robots.txt: syntax, the rules Google follows, how it differs from noindex, its security limits and how WordPress's virtual robots.txt works."
language: "en"
locale: "en-US"
type: "definition"
canonical: "https://www.wp-feint.com/glossary/robots-txt/"
published: "2026-10-28T08:00:00+00:00"
modified: "2026-11-22T12:08:28+00:00"
translations:
  en-US: "https://www.wp-feint.com/glossary/robots-txt/index.md"
  fr-FR: "https://www.wp-feint.com/fr/definitions/robots-txt/index.md"
  es-ES: "https://www.wp-feint.com/es/glosario/robots-txt/index.md"
  de-DE: "https://www.wp-feint.com/de/glossar/robots-txt/index.md"
  it-IT: "https://www.wp-feint.com/it/glossario/robots-txt/index.md"
  pt-BR: "https://www.wp-feint.com/pt/glossario/robots-txt/index.md"
  nl-NL: "https://www.wp-feint.com/nl/woordenlijst/robots-txt/index.md"
---

# Robots.txt

Robots.txt is a text file placed at the root of a website that tells crawlers which URLs they may or may not crawl. It manages crawling, not indexing or security: compliance is voluntary, and a disallowed page can still show up in search results.

The robots.txt file is the first thing a well-behaved crawler reads before crawling a site. It goes at the root of the domain (`https://example.com/robots.txt`) and only applies to the host, protocol and port that serve it: a subdomain needs its own file. Its syntax fits in a few lines, but a single mistake can make an entire site vanish from search engines.

## The syntax

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

User-agent: GPTBot
Disallow: /

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

- `User-agent` names the crawler concerned (`*` for all of them). Google applies the most specific group that matches its crawler.
- `Disallow` and `Allow` block or allow paths. When rules conflict, the longest rule wins, and in a tie, the least restrictive one.
- `Sitemap` gives the full URL of the [XML sitemap](https://www.wp-feint.com/glossary/xml-sitemap/).

Google only supports these four fields: `Crawl-delay`, for example, is ignored by Googlebot. Paths are case-sensitive, the file is limited to 500 KiB and Google generally caches it for up to 24 hours. If the file returns a 404 error, Google assumes there are no restrictions; if it returns a server error (5xx), Google stops crawling at first, then falls back on the last known version.

## What robots.txt doesn't do

This is the most widespread confusion: robots.txt controls crawling, not [indexing](https://www.wp-feint.com/glossary/indexing/). Google says it clearly: it is not a way to keep a page out of its results. A blocked URL can still appear in the results, without a description, if other pages link to it. Worse, a blocked page can't pass on its `noindex` tag, since the crawler never reads it.

![Three-column comparison. robots.txt (Disallow): prevents crawling, the URL can still appear in Google if links point to it, public file with voluntary compliance, used to reduce crawling. noindex (tag or header): removes the page from the results, the page must stay crawlable to be read, for pages useful to visitors but useless in Google. Password or server block: the only real access control, also blocks malicious bots, for staging sites, private areas and backups. Note: a page blocked by robots.txt can't show its noindex tag to the crawler.](https://www.wp-feint.com/media/2026/10/robots-txt-noindex-mot-de-passe-en.webp)

Nor is it a security tool. Compliance is voluntary: Googlebot and reputable crawlers follow the rules, malicious scanners ignore them, and some read the file precisely to find interesting paths. Never list a backup folder or a staging site in it: protect them on the server side, as explained in [our article on exposed sensitive files](https://www.wp-feint.com/exposed-sensitive-files-env-git-sql/).

*Video: “How Robots.txt Works” (Google Search Central)*

## robots.txt and AI crawlers

The file is also used to set a policy toward artificial intelligence crawlers: allowing assistants' search crawlers while refusing those that collect training data, for example. The bot-by-bot choice is discussed in [our article on GPTBot, ClaudeBot and PerplexityBot](https://www.wp-feint.com/ai-crawlers-gptbot-claudebot-block/), and how it fits with llms.txt in [our guide to GEO for a secure WordPress site](https://www.wp-feint.com/geo-secure-wordpress-llms-txt/).

## For WordPress

- **A virtual file**: without a physical file, WordPress generates a robots.txt that blocks `/wp-admin/` while allowing `admin-ajax.php`, and since version 5.5 adds the `/wp-sitemap.xml` sitemap URL to it. A robots.txt file uploaded to the root replaces this virtual file.
- **SEO plugins** often include a robots.txt editor in the Dashboard; check the result by opening the URL in a browser.
- **The “Discourage search engines from indexing this site” checkbox** (Settings > Reading) has no longer written `Disallow: /` since WordPress 5.3: it adds a `noindex` robots tag instead, which is more effective at keeping the site out of the results.
- **What not to block**: theme and plugin folders that contain the CSS and scripts needed to display the page, otherwise Google sees a broken page.

Bots that ignore robots.txt and probe nonexistent URLs can be detected with [bot traps](https://www.wp-feint.com/features/bot-traps/): WP Feint counts these visits and, in the Pro version, can keep the most persistent ones out, without replacing a firewall.

## Related terms

- [XML sitemap](https://www.wp-feint.com/glossary/xml-sitemap/)
- [Indexing](https://www.wp-feint.com/glossary/indexing/)
- [Crawl budget](https://www.wp-feint.com/glossary/crawl-budget/)
- [llms.txt](https://www.wp-feint.com/glossary/llms-txt/)
- [GEO (Generative Engine Optimization)](https://www.wp-feint.com/glossary/generative-engine-optimization/)
- [Nofollow attribute](https://www.wp-feint.com/glossary/nofollow-attribute/)


## Sources

- [Google Search Central : introduction aux fichiers robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/intro)
- [Google Search Central : comment Google interprète la spécification robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt)
- [Google Search Central : bloquer l’indexation avec noindex](https://developers.google.com/search/docs/crawling-indexing/block-indexing)
- [WordPress Core : changements pour empêcher l’indexation des sites (WordPress 5.3)](https://make.wordpress.org/core/2019/09/02/changes-to-prevent-search-engines-indexing-sites/)
