In more detail
Rules use User-agent, Disallow and Allow lines, plus a Sitemap line. It controls crawling, not indexing: a blocked URL can still appear in results, so use noindex to keep a page out. Never use it to hide sensitive content.
robots.txt is a public text file at a site's root that tells crawlers which paths they may or may not fetch.
Last reviewed:
Rules use User-agent, Disallow and Allow lines, plus a Sitemap line. It controls crawling, not indexing: a blocked URL can still appear in results, so use noindex to keep a page out. Never use it to hide sensitive content.