{"id":2878,"date":"2026-08-04T09:32:34","date_gmt":"2026-08-04T09:32:34","guid":{"rendered":"https:\/\/2tentech.com\/blog\/?p=2878"},"modified":"2026-08-04T09:00:51","modified_gmt":"2026-08-04T13:00:51","slug":"robots-txt-guide","status":"publish","type":"post","link":"https:\/\/2tentech.com\/blog\/robots-txt-guide\/","title":{"rendered":"Robots.txt: How to Control What Search Engines Crawl"},"content":{"rendered":"<h2>What is robots.txt?<\/h2>\n<p><a href=\"\/glossary\/robots-txt\/\">Robots.txt<\/a> is a plain text file at the root of your site that tells search engine crawlers which paths they may or may not request. It is one of the simplest tools in <a href=\"\/blog\/technical-seo-guide\/\">technical SEO<\/a>, and also one of the easiest to get wrong.<\/p>\n<p>The key thing to understand is that robots.txt controls crawling, not indexing. It manages where bots go, not whether a page can appear in results. Google&#8217;s <a href=\"https:\/\/developers.google.com\/search\/docs\/crawling-indexing\/robots\/intro\" target=\"_blank\" rel=\"noopener\">introduction to robots.txt<\/a> documents the syntax and its limits.<\/p>\n<h2>Why robots.txt matters<\/h2>\n<p>On large sites, robots.txt helps steer crawl attention away from low-value areas like internal search results or admin paths, so crawlers spend more effort on pages that matter. This supports healthy <a href=\"\/glossary\/crawlability\/\">crawlability<\/a>.<\/p>\n<p>The risk is that a single broad rule can block an entire section by mistake, cutting off pages you need indexed. Because the file is so powerful and so simple, small errors have large effects.<\/p>\n<h2>How robots.txt works<\/h2>\n<ul>\n<li>It uses <code>User-agent<\/code> lines to target specific crawlers and <code>Disallow<\/code> or <code>Allow<\/code> lines to set rules.<\/li>\n<li>A disallowed path will not be crawled, but if it is already indexed or linked elsewhere, it can still appear in results without a snippet.<\/li>\n<li>To keep a page out of the index, do not block it here. Allow crawling and use a noindex tag so engines can see and honor it.<\/li>\n<li>You can reference your XML sitemap in robots.txt to aid discovery.<\/li>\n<\/ul>\n<h2>Robots.txt vs noindex<\/h2>\n<p>This is the most important distinction to remember.<\/p>\n<ul>\n<li>Use <strong>robots.txt<\/strong> to manage crawling and crawl budget.<\/li>\n<li>Use <strong>noindex<\/strong> to keep a page out of the index. This requires the page to be crawlable, so do not block it in robots.txt at the same time.<\/li>\n<\/ul>\n<p>Blocking a page in robots.txt when you actually want it removed from the index is a common and costly mistake, because the engine cannot crawl the page to see the noindex signal.<\/p>\n<h2>Common robots.txt mistakes<\/h2>\n<ul>\n<li>Disallowing a folder that contains pages you want indexed.<\/li>\n<li>Trying to remove a page from search with a disallow rule alone.<\/li>\n<li>Blocking CSS or JavaScript that the page needs to render correctly.<\/li>\n<li>Leaving a site-wide disallow in place after launch, left over from development.<\/li>\n<\/ul>\n<h2>Key takeaways<\/h2>\n<ul>\n<li>Robots.txt controls crawling, not indexing.<\/li>\n<li>To remove a page from the index, allow crawling and use noindex, not a disallow rule.<\/li>\n<li>Test changes carefully, because one broad rule can hide an entire section.<\/li>\n<\/ul>\n<h2>Frequently asked questions<\/h2>\n<p><strong>Will robots.txt remove a page from Google?<\/strong><br \/>\nNot reliably. A disallowed page can still be indexed if it is linked elsewhere. Use a noindex tag on a crawlable page to remove it.<\/p>\n<p><strong>Should I block CSS and JavaScript?<\/strong><br \/>\nNo. Search engines need those files to render and understand the page. Blocking them can hurt how your pages are evaluated.<\/p>\n<hr \/>\n<p><em>Part of our <a href=\"\/blog\/technical-seo-guide\/\">Technical SEO guide<\/a>. For help, see our <a href=\"\/seo-services\/technical-seo\/\">Technical SEO service<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Robots.txt tells search engine crawlers which paths they may request. Learn how it works, what it cannot do, and how to avoid costly mistakes.<\/p>\n","protected":false},"author":1,"featured_media":2915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":{"rank_math_focus_keyword":"robots.txt","rank_math_title":"Robots.txt: How to Control What Search Engines Crawl | 2tentech","rank_math_description":"Robots.txt tells crawlers which paths they may request. Learn how it works, what it cannot do, and how to avoid costly mistakes.","footnotes":""},"categories":[1],"tags":[175,174,163],"class_list":["post-2878","post","type-post","status-publish","format-gallery","has-post-thumbnail","hentry","category-seo","tag-crawl-budget","tag-robots-txt","tag-technical-seo","post_format-post-format-gallery"],"_links":{"self":[{"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/posts\/2878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/comments?post=2878"}],"version-history":[{"count":2,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/posts\/2878\/revisions"}],"predecessor-version":[{"id":2895,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/posts\/2878\/revisions\/2895"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/media\/2915"}],"wp:attachment":[{"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/media?parent=2878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/categories?post=2878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2tentech.com\/blog\/wp-json\/wp\/v2\/tags?post=2878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}