Robots.txt Guide: How to Control What Google Crawls

A single misconfigured line in a robots.txt file can block Google from crawling your entire website. That is not hyperbole. It is one of the most common and most damaging technical SEO mistakes we find in audits. A proper robots txt seo guide does more than explain the syntax. It explains the consequences of getting it wrong, which are significant enough that this file deserves careful attention from anyone responsible for a website’s search performance.

Robots.txt is a plain text file that tells search engine crawlers which parts of your site they are allowed to access. It is one of the first files Googlebot reads when it visits a domain. The instructions inside it shape what gets crawled, what gets indexed, and ultimately what can appear in search results.

Knowing how to use it correctly is foundational technical SEO.

Is your website invisible on Google?

Get a free, no-obligation SEO audit from a real expert 100% free, actionable insights, and built to boost your rankings.

Get a Free Audit

What Robots.txt Actually Does and Does Not Do

Most businesses either ignore robots.txt entirely or treat it as a tool to hide pages from search results. Both misunderstandings lead to problems.

Robots.txt controls crawl access, not indexation. This is the distinction that matters most.

What Robots.txt Actually Does and Does Not Do

If you block a URL in robots.txt, Google cannot crawl it. But if other sites link to that URL, Google may still know the URL exists and may still include it in search results as an unverified entry, with no snippet or description because it could not read the page. Blocking in robots.txt is not the same as no indexing.

The right tool for preventing a page from appearing in search results is a no index meta tag on the page itself, not a robots.txt Disallow rule. robots.txt is for managing what Google spends its crawl budget on, not for hiding content.

What robots.txt is legitimately used for:

  • Blocking crawlers from staging environments or development subdomains
  • Preventing crawl of admin areas, login pages, and internal tools
  • Managing crawl budget by excluding low-value parameter-driven URLs on large sites
  • Preventing crawl of duplicate content created by pagination or filter pages
  • Blocking specific non-Google bots from crawling your site

What robots.txt should not be used for:

  • Hiding sensitive information (crawlers cannot access it, but the file itself is public)
  • Preventing indexation of pages that should not rank (use no index instead)
  • Replacing proper access controls on genuinely private content

Robots.txt Syntax: The Core Rules

The robots txt seo guide syntax is straightforward, but precision matters. A missing slash, an incorrect wildcard, or a misplaced rule can produce unintended behavior that is difficult to diagnose without careful testing.

Basic structure:

User-agent: *

Disallow: /private/

Allow: /private/allowed-page/

Sitemap: https://www.yourdomain.com/sitemap.xml

Robots.txt Syntax

User-agent specifies which crawler the rules apply to. An asterisk (*) applies to all crawlers. Googlebot, Bingbot, and other specific crawlers can be named individually to apply rules only to them.

Disallow specifies paths the crawler cannot access. The rule applies to the path and everything below it. Disallow: /admin/ blocks all URLs beginning with /admin/.

Allow can be used to create exceptions to Disallow rules. If you block a directory but want to allow one specific page within it, Allow takes precedence over Disallow for the specific path.

Sitemap is included at the bottom of the file to tell crawlers where to find your XML sitemap. This is not required but is a recommended practice.

Is your website invisible on Google?

Get a free, no-obligation SEO audit from a real expert 100% free, actionable insights, and built to boost your rankings.

Get a Free Audit

Wildcard Patterns

Google supports two wildcard characters in robots.txt:

WildcardMeaningExample
*Matches any sequence of charactersDisallow: /*.pdf$
$Matches the end of the URLDisallow: /search$

Wildcard patterns give you more granular control over URL patterns. Disallow: /*?* would block all URLs containing a query parameter, which is useful for blocking faceted navigation on eCommerce sites. Disallow: /*.pdf$ would block all PDF file URLs.

Bing and other crawlers may handle wildcards differently from Google. If targeting specific crawlers with wildcard rules, verify behavior with each crawler’s documentation.

How to Audit Your robots.txt File

Auditing robots.txt before making any changes is the right sequence. The file is public at yourdomain.com/robots.txt. Viewing it takes seconds. Understanding what each rule is doing and whether it reflects current intention takes more care.

How to Audit Your robots.txt File

Step 1: View the current file.

Navigate directly to yourdomain.com/robots.txt in a browser. Read every Disallow rule and ask: is this still intentional? Is this blocking something that should be crawled?

Step 2: Test specific URLs against the file.

Google Search Console includes a robots.txt tester under Settings that lets you enter specific URLs and check whether they are blocked or allowed by the current rules. Use this to verify that important pages, service pages, product pages, blog posts, are not accidentally blocked.

Step 3: Cross-reference with Search Console crawl data.

In the URL Inspection tool, enter URLs that should be indexable and confirm they are not blocked by robots.txt. If a page returns a “Blocked by robots.txt” status when it should be accessible, the file has an unintended rule in place.

Step 4: Check alignment with your sitemap.

Any URL in your XML sitemap should be accessible to crawlers. A URL that appears in the sitemap but is blocked by robots.txt sends a conflicting signal: the sitemap says Google should index it, robots.txt says it cannot crawl it. Fix the conflict by either removing the URL from the sitemap or removing the Disallow rule. The xml-sitemap-best-practices guide covers sitemap configuration in detail and explains how robots.txt and sitemap alignment affects crawl efficiency.

The broader technical SEO context that robots.txt operates within, including how it interacts with crawl budget management and indexation signals, is covered in the what-is-technical-seo guide.

Is your website invisible on Google?

Get a free, no-obligation SEO audit from a real expert 100% free, actionable insights, and built to boost your rankings.

Get a Free Audit

Common robots.txt Mistakes That Cost Rankings

Leaving the development no index on production. 

This is the most frequently encountered catastrophic robots.txt error. Staging and development environments should block all crawlers using a Disallow: / rule so that partial or duplicate content does not get indexed. When the site launches to production, that rule has to be removed. Sites that launch with Disallow: / in place are completely invisible to Google. We have seen this happen with established businesses after a site rebuild, resulting in a complete loss of organic traffic until the error is caught and the file is corrected.

Common robots.txt Mistakes That Cost Rankings

Blocking important directories to hide specific pages. 

A business that wants to prevent one page from ranking sometimes adds a Disallow rule for the entire directory containing that page. This blocks every page in that directory, including pages that should rank. Use no index on the specific page instead of blocking the directory in robots.txt.

Using robots.txt to block sensitive data rather than using proper access controls. 

Robots.txt is a public file. Any crawler or user can view it. If you block a directory in robots.txt to hide sensitive data, you have inadvertently shown the world that the directory exists and that something worth blocking is in it. Sensitive data needs server-level authentication or proper access controls, not a robots.txt rule.

Not updating robots.txt after a site redesign or migration. 

A site migration often involves new URL structures, new subdirectories, and new content types. If the robots.txt file is not updated to reflect these changes, old Disallow rules may now block new sections of the site that should be crawled. After any significant site architecture change, robots.txt should be reviewed and updated before the migration is considered complete.

Blocking CSS and JavaScript files. 

Some older robots.txt configurations block CSS and JavaScript directories to reduce crawl load. Google needs to render pages correctly to evaluate their content and quality. Blocking the CSS and JavaScript files required to render a page prevents Google from seeing the page the way a user does, which leads to lower quality assessments and suppressed rankings. Google explicitly recommends allowing CSS and JavaScript to be crawled.

FAQ

Can robots.txt prevent a page from appearing in Google search results?

No. robots.txt prevents Google from crawling a URL, but if other sites link to that URL, Google may still include it in search results as a known URL without a snippet. To prevent a page from appearing in search results, use a noindex meta tag on the page itself. No index is the correct tool for indexation control; robots.txt is the correct tool for crawl access control.

What happens if I accidentally block my site with robots.txt?

Google stops crawling all pages covered by the Disallow rule. If the rule blocks the entire site, your pages can disappear from search results within days as Google re-evaluates cached content. The fix is to remove or correct the Disallow rule and submit the corrected file via Google Search Console. Rankings typically begin recovering within weeks after the file is corrected, though the recovery timeline depends on how long the block was in place.

Should I block all crawlers or just Google?

It depends on the purpose of the rule. If you are managing crawl budget for Google specifically, use User-agent: Googlebot with your Disallow rules. If you want to prevent all crawlers including scrapers and competitive intelligence tools from accessing certain areas, use User-agent: *. Both approaches have legitimate use cases. Most crawl budget management should target specific named crawlers rather than using the wildcard.

How often should I review my robots.txt file?

After any significant site change: a redesign, a platform migration, a new subdomain launch, or a content restructuring. Additionally, any time Search Console shows unexpected crawl coverage gaps or a significant drop in indexed pages, robots.txt is one of the first places to check. For stable sites with no recent changes, a quarterly review is a reasonable minimum to confirm that configurations remain intentional.

Does robots.txt affect crawl budget?

Yes, directly. Disallowing low-value URLs from being crawled frees up crawl budget for the pages that matter. On large sites with faceted navigation, session parameters, or extensive archive pages, strategic robots.txt configuration is one of the most effective ways to ensure Googlebot spends its crawl allocation on commercial and content pages rather than parameter-driven duplicates.

Is your website invisible on Google?

Get a free, no-obligation SEO audit from a real expert 100% free, actionable insights, and built to boost your rankings.

Get a Free Audit

The Bottom Line

robots.txt is a small file with significant consequences. One wrong Disallow rule on the wrong directory can suppress rankings across an entire section of a site without any visible warning. Understanding the robots txt seo guide principles covered here is the difference between using this tool to strategically manage crawl behavior and accidentally using it to undermine the indexation your SEO work is trying to achieve.

The businesses that maintain clean, intentional robots.txt configurations as part of their ongoing technical SEO practice do not face the crawl surprises that derail sites after rebuilds and migrations. The ones that set it once and forget it eventually pay the cost of that neglect.

Want to verify that your robots.txt file is not quietly blocking rankings you have earned?

If you want a strategy that actually fits your business, book a free strategy call. We will walk you through your technical configuration and identify any crawl issues affecting your site. Visit our Technical SEO Service Page to learn more about how we approach this work.