Robots.txt Best Practices for Crawl Budget

MT
Written by the MyToolDock team
Category: SEO Tools · Published

In this guide

The robots.txt file is a plain text file at the root of your site that tells well-behaved crawlers which paths they may fetch. It is simple, but a single wrong line can block your whole site from search engines, so it deserves care.

The basic syntax

A group starts with User-agent, naming the crawler, or an asterisk for all. Disallow lists paths the crawler should not fetch and Allow makes exceptions. A line such as Disallow: /admin/ blocks that folder, while Disallow: / blocks everything, and an empty Disallow allows everything. You can add a Sitemap line giving the full address of your sitemap.

It controls crawling, not indexing

Blocking a URL in robots.txt stops crawling, but the URL can still appear in search results if other pages link to it, without a description. To keep a page out of results, allow it to be crawled and use a noindex meta tag instead. If you block the page in robots.txt, the crawler never sees the noindex.

It is not security

The file is public and obeying it is voluntary. Listing a private folder in it advertises its existence. Protect sensitive areas with authentication.

Common mistakes

Leaving Disallow: / from a staging site on the live site, blocking CSS and JavaScript files that search engines need to render the page, using wrong paths (they are case-sensitive and start with a slash), and putting the file in a subfolder where crawlers will not find it.

Test before and after

Generate the file, validate the syntax, and check key URLs against the rules. After deploying, confirm the file loads at /robots.txt and watch Search Console for crawl problems.

Worked example: blocking two folders

The robots.txt Generator with /admin/ and /cart/ as disallowed paths and a sitemap address produced User-agent: *, Disallow: /admin/, Disallow: /cart/ and a Sitemap line pointing at https://example.com/sitemap.xml. The robots.txt Validator then accepted a file with an Allow rule for /admin/public/ and reported no syntax issues.

A valid file is not the same as a correct one: a stray Disallow: / blocks the whole site and is still valid. Test the paths you care about after publishing, and remember that robots.txt stops crawling, not indexing, so a blocked page can still appear in results if other sites link to it.

Key Takeaways

Frequently Asked Questions

Where does robots.txt go?

At the root of the domain, for example example.com/robots.txt.

How do I keep a page out of Google?

Use a noindex meta tag and let the page be crawled, or require a login.

Do all bots obey robots.txt?

Reputable crawlers do; malicious ones may ignore it.

Free tools mentioned in this guide

Browse every SEO Tools utility, or see all tools.

Recommended Reading

Developer Scratchpad

Copied to clipboard!