robots.txt is a text file at the domain root (/robots.txt) telling search bots which URLs to crawl and which to skip. Robots Exclusion Protocol (REP, formalized in RFC 9309, 2022). Important: robots.txt is a *recommendation*, not a hard block. Malicious bots ignore it. For real prevention, use auth/firewall.
Below: details, example, related terms, FAQ.
Free online tool — HTTP header checker: instant results, no signup.
User-agent: *
Disallow: /admin/
Disallow: /*.pdf$
Allow: /admin/public/
Sitemap: https://example.com/sitemap.xmlThe syntax of the robots.txt file is crucial for effectively communicating with search engine crawlers. The file consists of a series of directives that tell bots which parts of your site to crawl or avoid. The basic structure includes User-agent and Disallow directives.
Here’s a breakdown of the syntax:
Googlebot) or use * to apply to all bots.Disallow: /directory/.Disallow directive, permitting access to specific pages within a blocked directory.Sitemap directive can help bots find the sitemap of your site, which is beneficial for indexing.Here’s a simple example of a robots.txt file:
User-agent: *
Disallow: /private/
Allow: /private/public-page.html
Sitemap: https://www.example.com/sitemap.xml This configuration tells all bots to avoid crawling the /private/ directory except for the public-page.html, while also providing the location of the sitemap.
Misconfigurations in the robots.txt file can lead to unintended consequences, such as blocking search engines from indexing important pages on your website. Here are some common pitfalls:
Disallow: / will block all crawlers from accessing any part of your site, which is often not the desired outcome. Ensure that your disallow rules are specific enough to protect sensitive areas without hindering crawling.Allow directives judiciously to permit access to critical content.robots.txt entries match the exact case of your URLs.To troubleshoot issues, use tools like Google Search Console, which can analyze your robots.txt file and provide insights on how it affects crawling and indexing. Regular audits can help ensure your file is functioning as intended.
Testing and validating your robots.txt file is essential to ensure it functions as intended. Several tools and methods can help you verify the correctness of your file:
robots.txt rules. This is an invaluable resource for diagnosing issues.robots.txt file, ensuring it adheres to the Robots Exclusion Protocol. Examples include robots-txt-validator.com.robots.txt file by visiting https://www.yourdomain.com/robots.txt in your browser. This allows you to see the current directives and verify that they are correctly formatted.When testing, consider using different user-agents to simulate how various bots will interpret your robots.txt file. This comprehensive approach will help ensure that your directives are clear and effective, safeguarding your website's content while optimizing it for search engine visibility.
Google keeps crawling as usual, Yandex too. But if robots.txt returns 5xx — Google halts crawl for 12 hours. Serve a 200 or 404.
No. Disallow blocks *crawling* but not *indexing* (an external link can make the URL appear in the index without content). For indexing use meta noindex.
In major bots yes: <code>Disallow: /*.pdf$</code>. RFC 9309 formalized wildcards.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.