Technical SEO

What Is robots.txt?

robots.txt is a plain-text file at the root of a website that tells crawlers which paths they may and may not request. It controls crawling only. It does not control indexing, it does not secure anything, and every rule in it is public to anyone who opens the file.

Key facts

  • The file always lives at the root: example.com/robots.txt.
  • It controls crawling, not indexing. Blocked URLs can still appear in results.
  • It is public. Never use it to hide sensitive paths.
  • Mainstream crawlers respect it; malicious ones do not.

What should a robots.txt file do?

For most sites, very little, and that is correct.

  • Allow crawling of everything that should be found.
  • Block genuinely useless paths, such as internal search results and infinite filter combinations.
  • Point to the XML sitemap.
  • Say nothing about admin paths you would rather nobody knew about.

A staging site is built with Disallow: / to keep it out of search. The site goes live, the file comes with it, and the whole site is blocked from crawling. It is one of the most common causes of a sudden total traffic loss after a launch.

The related trap: blocking a page in robots.txt to remove it from Google. Because the crawler can no longer fetch the page, it never sees the noindex tag, and the URL can stay in the results indefinitely.

robots.txt FAQs

How do I remove a page from Google?

Allow crawling and add a noindex tag to the page, or remove the page and return a 404 or 410. Blocking in robots.txt achieves the opposite of what people expect.

Should I block AI crawlers in robots.txt?

Only if you accept the consequence. Blocking them removes your site from those tools' answers, which for most businesses is worse than being quoted. It is a reasonable choice for publishers whose business is the content itself.

Does robots.txt affect ranking?

Not directly, but a mistake in it can stop pages being crawled, which prevents ranking entirely. It is worth checking after any launch, migration or platform change.

Pavan Vora, SEO expert in Ahmedabad

Pavan Vora – Freelance SEO Expert in Ahmedabad, 11+ years

Definition last reviewed . Get a free SEO review →

Want more customers from Google?

Get a free 30-minute SEO consultation. I'll look at your website and tell you the 3 biggest things holding it back – no obligation.

Book Free Consultation