Brand, websites, SEO & GEO and automations for small businesses.

WhatsApp
Guides

The robots.txt File: What It Does and Pitfalls to Avoid

What is robots.txt? How this plain text file directs search engine crawlers, what it cannot do, and common configuration mistakes that hide web pages.

Small white barrier gate with a blue stripe positioned in front of a neat row of white file folders

The robots.txt file is a lightweight plain text document placed at the root of your web domain that instructs search engine crawlers which sections they are permitted to explore and which directories they should skip. It spans only a few lines, yet remains one of the most common causes of sudden organic disappearance: an erroneous directive, frequently copied from a staging server after a redesign, drops pages from search results without generating error warnings. Here is what this file accomplishes, what it cannot do, and how to verify yours.

What is a robots.txt file?

It is a plain text file named robots.txt, formatted in lowercase and hosted directly at your domain root (for instance https://www.example.com/robots.txt). Every compliant web crawler inspects this file prior to indexing site pages. It contains grouped directives: designated crawler agents (User-agent), blocked paths (Disallow), permitted exceptions (Allow), and the URL of your XML sitemap (Sitemap).

A typical configuration for an independent business looks like this:

User-agent: *
Disallow: /admin/
Disallow: /cart/
Allow: /

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

How to read it: all automated web bots (*) may crawl everything, except the administrative backend and shopping cart flows, with the canonical XML sitemap located at the designated address. If you have no directories to restrict from crawlers, a file containing solely the Sitemap directive is entirely valid. If you lack an XML sitemap, our guide explains what an XML sitemap is and how to create one.

Core operational rules documented by Google Search Central:

  • Directives apply strictly to the exact host and protocol where the file is served. The file at www.example.com does not govern sub.example.com.
  • Directory paths are strictly case-sensitive: Disallow: /Staff/ does not restrict /staff/.
  • Google parses four specific fields: user-agent, allow, disallow, and sitemap. Legacy directives like crawl-delay are ignored by Googlebot.
  • Google caps parsed file size at 500 kibibytes, matching minimum standards established under RFC 9309, caching parsed directives for up to 24 hours.

What robots.txt cannot do: hiding a page from search results

The robots.txt file prevents an automated bot from crawling a page; it does not prevent search engines from indexing the URL. Google states this explicitly: robots.txt is not a mechanism for keeping web pages out of Google search results. A page disallowed in robots.txt will still be indexed if external websites link to it: Google detects the incoming link and lists the URL in search results without a descriptive text snippet. Search Console flags these cases as "Indexed though blocked by robots.txt".

To completely remove a web page from search results, embed an explicit noindex directive within page markup (<meta name="robots" content="noindex">) or return an HTTP header (X-Robots-Tag: noindex). Crucially: the page must remain fully accessible to crawlers in robots.txt so Googlebot can crawl the URL and read the noindex command. Blocking the page in robots.txt prevents the crawler from discovering your removal directive.

For genuinely private company data (client portals, confidential internal documentation), authentic password authentication represents the only secure barrier. The robots.txt file is entirely public, and listing sensitive internal paths within it merely advertises their existence. Furthermore, attempting to use Noindex: directives inside robots.txt is obsolete: Google ceased supporting that syntax in September 2019.

Desired objectiveAppropriate technical mechanism
Stop crawlers wasting crawl budget on faceted filters or internal searchDisallow directives inside robots.txt
Keep a public page out of search engine indexationPage-level noindex tag with crawler access permitted
Prevent unauthorized human visitors from viewing private contentServer password protection or secure user logins

Common configuration errors that hide your website

The most devastating mistake is leaving a global Disallow: / directive active across production. In twelve characters, your entire domain is blocked from crawlers, causing existing search rankings to decay. We frequently encounter this following an agency redesign: the staging environment was blocked during development, and the file was carelessly copied to production upon launch. If preparing a launch, pair this check with planning 301 redirects to avoid losing traffic.

Other widespread errors are more subtle:

  • Blocking CSS stylesheets and JavaScript files. Googlebot renders web pages like a modern browser to understand visual layouts, and official documentation warns that it cannot execute scripts residing inside blocked folders. A legacy Disallow: /wp-content/ directive can make a modern website appear as an empty blank screen to search algorithms.
  • Server errors when requesting the file. If robots.txt returns an HTTP 5xx server error, Googlebot pauses crawling for 12 hours before reusing cached versions for up to 30 days. Conversely, a 404 response is harmless: Google assumes full crawler access is permitted.
  • Case mismatches and obsolete paths. Writing /Staff/ instead of /staff/, or maintaining rules for legacy folder architectures retired years ago.

Managing artificial intelligence search crawlers

The robots.txt file also allows you to control which artificial intelligence crawlers may index your website, with different AI agents serving distinct purposes. OpenAI documents three primary crawlers: GPTBot (which collects training data for foundational models), OAI-SearchBot (which surfaces websites within ChatGPT search citations), and ChatGPT-User (which browses web destinations upon direct user request). For Google, the Google-Extended token controls whether content trains Gemini models, with Google confirming that disallowing it does not impact traditional search rankings.

Commercial publishers reliant on content licensing often block training crawlers (User-agent: GPTBot followed by Disallow: /) while allowing search agents like OAI-SearchBot.

Studio perspective

For an independent business seeking commercial clients, blocking AI search bots is counterproductive: you exclude your business from being cited in environments where prospective clients increasingly conduct research. For restaurants, medical clinics, or trade professionals, we recommend permitting search bots and focusing on content clarity. Our guide on how to be cited by ChatGPT and AI engines details what moves the needle.

How to verify your robots.txt file in five minutes

Type your domain name followed by /robots.txt in a private browser window. If the file renders, verify that you do not see a solitary Disallow: / or rules blocking stylesheets, scripts, or media folders. If the browser returns a 404, there is no panic: without a file, crawlers treat the entire domain as accessible.

Next, open Google Search Console. The robots.txt report (accessible under Property Settings) confirms which file Googlebot retrieved, when it was last fetched, and any syntax errors, providing a tool to request immediate re-crawling following fixes. The Pages report lists URLs flagged as "Blocked by robots.txt" alongside those "Indexed though blocked". If you are unfamiliar with these screens, consult our guide to Search Console for beginners.

For an automated check, our free website audit tool audits robots.txt alongside page speed, foundational SEO, and AI readability.

Locating robots.txt across WordPress, Shopify, and custom builds

On WordPress, the file is often generated dynamically, with SEO plugins providing visual settings panels to adjust directives. If a physical robots.txt file exists in your server root directory, it takes precedence. Be cautious of the native setting "Discourage search engines from indexing this site" under Settings > Reading: it adds sitewide noindex directives across all pages. Ensure this box is unchecked at launch.

On Shopify, the file is managed through a template named robots.txt.liquid inside theme code, with Shopify warning that improper rules can eliminate storefront search traffic. On custom-coded builds, it is a plain text file hosted in your public web directory.

Studio practice: our approach at Resolve

At Resolve agency (Re:solve), robots.txt verification sits at the very beginning of every technical audit, because an error here invalidates all downstream optimization. During redesign projects, we protect staging sandboxes using HTTP authentication rather than Disallow rules, preventing accidental migration of blocking directives on launch day, and audit Search Console reports immediately following deployment.

Frequently asked questions

Is maintaining a robots.txt file mandatory?

No. In the absence of a file, search engine crawlers assume the entire site is open for indexation and crawl normally. However, publishing a minimal file containing your Sitemap path remains best practice to accelerate page discovery.

How long does it take for Google to process robots.txt edits?

Googlebot typically caches the file for up to 24 hours, though you can request immediate re-fetching via the Search Console robots.txt report. Restoring unindexed pages back to search results requires more time, as each page must be individually re-crawled.

Does an optimized robots.txt file boost Google search rankings?

No. The file contains zero ranking signals: it simply opens or closes technical crawl paths. Its commercial value lies in ensuring valuable pages remain unobstructed.

Further reading

Start today.

We review your brand, website and online visibility, then set out your priorities.

Chat on WhatsApp