Skip to content
Free website migration on every plan, done by our team.Learn more ›
Business

robots.txt: what it does and the mistakes to avoid

What robots.txt controls, how to write simple rules, how to point to your sitemap, and the common mistakes that accidentally hide websites from search engines.

Short answer: robots.txt is a plain text file at the root of your site that tells crawlers which paths they may fetch. Use it to keep crawlers out of admin and duplicate areas and to list your sitemap. It does not hide pages from search results; use a noindex tag for that.

A simple example

User-agent: *
Disallow: /admin/
Disallow: /cart/
Sitemap: https://yourdomain.com/sitemap.xml

In robots.txt, each Disallow line blocks a path, and the Sitemap line tells crawlers where your sitemap is. See XML sitemaps.

Common mistakes

  1. Disallow: / left over from a staging site, which blocks everything.
  2. Blocking CSS and JavaScript, so search engines can't render the page properly.
  3. Using robots.txt to hide private pages. The file is public, and blocked pages can still appear in results if linked elsewhere.
  4. Forgetting the sitemap line.

robots.txt vs noindex

GoalUse
Stop crawling of a sectionrobots.txt Disallow
Keep a page out of search resultsnoindex meta tag (page must stay crawlable)
Truly private contentA password, not either of the above

How to check yours

Visit yourdomain.com/robots.txt and use the robots.txt report in Google Search Console.

Frequently asked questions

Do all bots obey robots.txt?

Reputable crawlers do. Malicious bots ignore it, so it isn't a security tool.

Should I block AI crawlers?

That's a business choice. Blocking them may reduce how often AI tools can read and cite your site.

Ready when you are

Host it where it performs

NVMe speed, offshore privacy and a written SLA — live in minutes on AuroxHost.