Glossary

robots.txt

Written by
Outseen
Updated

Short answer

robots.txt is a text file in the root of a website that tells crawlers which parts of the site they may or may not fetch. It controls crawling, not indexing: a blocked URL can still appear in Google.

robots.txt is a text file in the root of a website, for example https://www.example.com/robots.txt. In it you tell each crawler which paths it may or may not fetch. Every host has its own file, so a subdomain needs its own robots.txt. Google explains the rules in How to write and submit a robots.txt file.

Example

User-agent: *
Disallow: /cart/

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

All crawlers may fetch the whole site except the /cart/ folder. The last line points to the XML sitemap.

Common mistake

Using robots.txt to keep a page out of Google. Google writes that robots.txt is not meant for that. A blocked URL can still appear in the results if other sites link to it, just without a description. To keep a page out of search results, use noindex and leave the page crawlable, otherwise Google never sees the instruction.

How do you check it?

Open /robots.txt on your own domain in a browser and read the rules. Check above all that no Disallow: / was left behind after a test phase. How to allow or block AI crawlers is explained in Allowing or blocking AI crawlers with robots.txt.

Sources

Read next