Creative agency glossarySEO and Analytics

Robots.txt

Robots.txt is a plain text file at the root of a website that tells crawlers which parts of the site they may and may not visit.

What is robots.txt?

Robots.txt is the oldest instruction a website gives a search engine. It is a text file that lives at one address, the domain followed by /robots.txt, and it contains rules in a simple format: which crawler the rule is for, what it may not fetch, what it may, and where the sitemap is. The convention dates from 1994 and was formalized as a standard in 2022. Every well-behaved crawler checks the file before touching anything else on the site.

The file is advisory. It tells a crawler not to fetch a path; it cannot stop one that chooses to ignore it, and it does not hide the page from the index. If other pages link to a URL that robots.txt blocks, Google can still list the URL in results, with no description, because it knows the address exists even though it has not read the page. Keeping a page out of search is the job of a noindex tag, which the crawler has to be allowed to fetch in order to read.

Why it matters

Why robots.txt matters

It is the first thing a crawler reads, and one wrong line can take a site out of search. A single Disallow: / left over from the staging environment blocks everything, and sites have gone dark at launch for exactly that reason. The reverse mistake, blocking the CSS and JavaScript files that render the page, leaves the crawler seeing an unstyled, half-empty version and ranking accordingly.

Used well, it protects crawl budget. Large sites generate endless URLs from filters, internal search, calendars and session parameters, and a crawler left to wander them wastes its visit. A few lines in robots.txt keep it on the pages that matter. It has also become the place where sites state their position on AI crawlers, which now check it for permission to collect training data.

In practice

How robots.txt works in practice

  1. 01

    The file is written by hand or generated by the content management system and placed at the root. Rules are grouped by user agent, with an asterisk for all crawlers and specific names for specific ones. Disallow lines block paths; Allow lines open exceptions inside them; a Sitemap line points to the XML sitemap. Google reads only the group that matches its crawler most specifically, so a rule for all crawlers does not apply to Googlebot if there is a Googlebot group.

  2. 02

    Testing matters more than writing. Search Console has a robots.txt report that shows the file Google last fetched and any errors, and a URL inspection tool that says whether a given page is blocked. Before launch and after any change to the file, check the key pages: the homepage, the main sections, and the asset folders the design depends on. Keep the file short, comment it, and put it in version control, because the person who edits it next will not remember why the rules are there.

Watch out

What people get wrong about robots.txt

Using it to hide pages. A blocked URL can still appear in search results if anything links to it, and the block prevents Google from reading the noindex tag that would actually remove it. To keep a page out of the index, allow the crawl and add noindex.

The other mistake is forgetting it is public. Anyone can read a site's robots.txt, and a Disallow line for a secret section is an invitation to look there. It is a crawl instruction, not security.

Questions

People also ask

Does robots.txt stop a page from being indexed?

No. It stops well-behaved crawlers from fetching the page, but if other pages link to it Google can still index the URL without its content. To keep a page out of search, let it be crawled and add a noindex meta tag or header.

Where should robots.txt be placed?

At the root of the domain, so it is reachable at yoursite.com/robots.txt. Crawlers only look there. Each subdomain needs its own file, and a file placed in a subfolder is ignored.

What should a basic robots.txt contain?

For most brand sites, very little: a rule for all user agents that disallows admin areas, internal search results and other pages that should not be crawled, allows everything else, and a Sitemap line pointing to the XML sitemap. If nothing needs blocking, an empty file or no file at all is fine.

Next to it in the glossary

  1. 200 (OK) Response CodeA 200 OK response code is the server's confirmation that a request succeeded and the page was delivered as asked.
  2. 301 RedirectA 301 redirect is a permanent instruction that sends browsers and search engines from an old URL to a new one, carrying the old page's ranking signals with it.
  3. 302 RedirectA 302 redirect is a temporary instruction that sends visitors from one URL to another while telling search engines the original address will return.
  4. 304 Not ModifiedA 304 Not Modified response tells a browser or a crawler that the page has not changed since it was last fetched, so the cached copy can be used instead.
  5. 307 Temporary RedirectA 307 Temporary Redirect sends a visitor to a different URL for now, while guaranteeing that the request is repeated exactly as it was made.
  6. 403 ForbiddenA 403 Forbidden error means the server understood the request but refuses to serve the page, usually because the visitor does not have permission to see it.

Every SEO and Analytics term →

In the work

Where it shows up

All our creations →

From the journal

Read around it

The journal →

Talking the talk is one thing

We make the work.

RIOT is a creative agency and production studio in New York. Strategy, brand, film, photography, design and the campaigns that carry them, made by one team. A few lines is enough to start: we read every brief the same day.

    Footage