Disallow directive

On this page 7

The Disallow directive is a rule in a robots.txt file that tells compliant crawlers which URL paths they must not request from a website. In crawling for SEO, it is the primary instrument for keeping bots away from areas such as internal search results, carts or staging paths, and for steering crawl budget toward pages that matter.

The directive is defined in the Robots Exclusion Protocol, standardized as RFC 9309 in 2022. It controls crawling, not indexing: a disallowed URL can still appear in search results if other pages link to it, which is the single most misunderstood aspect of the rule.

How the Disallow directive is read by crawlers

A crawler such as Googlebot or Bingbot fetches /robots.txt from the root of each host before crawling it, finds the group of rules for its user agent and compares every candidate URL path against the Disallow and Allow lines in that group. If the most relevant rule is a Disallow, the URL is not fetched.

Rules are grouped under one or more User-agent lines. A crawler obeys only the most specific group that matches its name and ignores the generic User-agent: * group when a named group exists. Paths are case-sensitive and matched from the beginning of the URL path, including the query string.

When Disallow and Allow rules both match, Google and RFC 9309 apply the longest matching rule, measured in characters; if two matching rules have equal length, the less restrictive Allow wins. Other crawlers may resolve conflicts differently, so complex overlapping rules carry a risk of inconsistent behavior.

Syntax and pattern matching

Disallow values are path prefixes that may contain two special characters: the asterisk matching any sequence of characters and the dollar sign anchoring the end of the URL. The table below shows how common values behave.

RuleBlocksDoes not block
Disallow: /The entire hostNothing on that host
Disallow: (empty)NothingAny URL
Disallow: /admin/admin, /admin/, /administrator/Admin (different case)
Disallow: /admin//admin/ and everything below it/admin without slash
Disallow: /*?sort=Any URL containing ?sort=/shoes/ without parameters
Disallow: /*.pdf$URLs ending in .pdf/file.pdf?v=2
Disallow values and their effect

Two practical details cause frequent errors. A value without a trailing slash is a prefix match, so /blog also blocks /blog-archive. A missing or empty robots.txt, or one returning a 4xx status, is treated as permission to crawl everything, while a 5xx server error makes Google pause crawling of the site because it cannot know which paths are allowed.

Disallow compared with noindex and other controls

Disallow is one of several controls over how search engines treat a URL, and choosing the wrong one is a common technical SEO mistake. The comparison below shows what each mechanism actually governs.

MechanismControls crawlingControls indexingTypical use
Disallow in robots.txtYesNoSaving crawl budget on low-value paths
Meta robots noindexNoYes, if the page is crawledKeeping a crawlable page out of results
X-Robots-Tag headerNoYes, if the file is crawledNoindex for PDFs and images
Canonical tagNoConsolidates signalsDuplicate URL variants
AuthenticationYesYesPrivate or staging content
Crawl and index controls

The key interaction is that Disallow hides a noindex tag. If a page is blocked, the crawler never sees its meta robots instruction, so the URL may remain indexed as a bare link without description. To remove a page from results, allow crawling and add noindex first, and disallow it only after it has dropped out of the index, if at all.

When to use Disallow

Disallow is most valuable on large sites where crawlers would otherwise spend requests on near-infinite URL spaces. The decision table below summarizes typical situations.

SituationRecommended approachReason
Faceted navigation parametersDisallow parameter patternsPrevents crawler traps and wasted budget
Internal search resultsDisallow the search pathLow-value and endlessly variable URLs
Thin page already indexedNoindex, keep crawlableCrawler must see the noindex
Staging environmentPassword protectionDisallow is public and not a barrier
CSS and JavaScript filesKeep allowedNeeded for rendering and evaluation
Shopping cart and checkoutDisallowNo search value and session URLs
Decision guide for Disallow

Limitations and common mistakes

The Disallow directive is a voluntary convention, not access control. Reputable search engine bots such as Googlebot, Bingbot, Applebot and YandexBot obey it, but scrapers and malicious bots can ignore it, and the robots.txt file itself is public, so listing secret paths advertises their location.

  • Blocking the whole site with Disallow: / after a launch, often copied from a staging configuration.
  • Blocking rendering resources, which can make pages look broken or empty to Google.
  • Expecting Disallow to remove indexed URLs; use noindex or the removal tools instead.
  • Forgetting that each subdomain and protocol needs its own robots.txt file.
  • Exceeding the 500 KiB size limit that Google applies; rules beyond it are ignored.
  • Relying on Crawl-delay, which Google does not support, alongside Disallow rules.

Changes take effect only after the crawler refreshes its copy, which Google generally caches for up to 24 hours. Testing every edit with the robots.txt report in Search Console and confirming impact in log file analysis prevents accidental loss of crawling on important sections.

Explained without jargon

Think of a website as a building and search engine robots as visitors who walk through it to make a map. The Disallow directive is a sign on certain doors saying not to enter. Polite visitors respect the sign and skip those rooms.

The sign does not lock the door, and it does not erase the room from the map if someone else already mentioned it. It simply tells well-behaved robots where not to walk, so that they spend their time on the rooms that matter.

A typical use case

An online fashion retailer with about 40,000 products notices in its server logs that Googlebot spends roughly 60 percent of its requests on filter combinations such as color, size and sort order. New product pages often wait more than a week before being crawled.

The technical SEO team adds rules such as Disallow: /*?sort= and Disallow: /*&size= while keeping the main category pages and their canonical filter pages crawlable. Before deployment, they test sample URLs to confirm that product pages remain allowed, and they leave CSS and JavaScript untouched.

Within six weeks, log analysis shows that requests to parameter URLs fall sharply and that new products are crawled within one to two days. Indexed page counts stay stable because the blocked filter URLs had canonical tags pointing to the main categories.