Why does the wildcard or regular expression for crawling exclusion files not work according to path prefix matching?

📅 October 12, 2026 👁️ 11

The reason why wildcard or regular expression is not effective when excluding files is that this protocol was never intended to express 'pattern' from the beginning. It does only one thing: it determines whether to exclude based on the prefix of the requested path. The protocol only recognizes two fields, and the matching rule is so simple that it only checks whether 'the path starts with a certain string.' Understanding this point is essential to explaining why many seemingly reasonable formats are treated as a plain prefix by the crawler.

Which two fields does the protocol recognize?

This crawling exclusion standard only uses two commands: User-agent and Disallow. User-agent declares the rules for which crawling party, and Disallow declares the exclusion of which path prefix. It doesn't even have an Allow field - in the early versions, the need to explicitly allow a sub-path could not be expressed, and had to be circumvented by other means.

Because there are only two fields, the expressiveness of the rules is very limited: what follows a Disallow is a string of characters treated as a path prefix, not a pattern string.

Why only match by prefix

The protocol clearly states that globbing (wildcard) and regular expressions are not supported in the User-agent and Disallow lines. That is, the crawler takes the Disallow value you wrote and directly compares it to the path part of the request URL, aligning from the beginning. If it matches, it is excluded; if it does not match, it is not excluded.

The rule you wrote How does the crawler actually understand Result
Disallow: /admin Exclude all paths that start with /admin As expected
Disallow: /*.php Treat as literal, matching paths starting with「*.php」 Almost no matches
Disallow: /tag/[^0-9] Treat as literal prefix, not a regular expression Not effective

What will happen with wildcard and regular expression syntax

Writing wildcard or regular expression not only does not cause an error, but it is also more dangerous—it ‘appears to take effect’ but actually does not. You think/*-page-\d+Blocking all pagination addresses, the crawler is actually looking for a path starting with a slash, a star,-page-, backslash, d, plus sign, this literal character string, almost never matches. The result is: you think the excluded path is usually crawled

Similarly, want to rely on?Wildcard query parameters, want to[]Matching character set, none of these rules are valid in this set. The protocol itself reminds: The crawler can choose to ignore this file, so it is never a security boundary, but just a declaration of intent for compliant crawlers.

What order should the rules be written in the site?

In practice, follow three steps. Step, translate the requirements into 'prefix' instead of 'pattern': to exclude a directory, write the directory path ending with a slash, and to exclude a category of naming conventions, find their common path prefix.Second step, each excluded directory is on a separate line, the rule blocks are separated by blank lines, and different User-agent groups are blocks.The third step, cooperate with the on-site pseudo-static rules to change the controllable dynamic address into a stable, prefix-clear path, and then exclude it will be more accurate - because after pseudo-static, the filtered pages and list pages have become neat directories, and prefix matching can express it clearly.AnQiCMS can be configured directly in the background for Robots.txt, and it also supports custom static rules. When used together, they can clearly express the 'blocked path' with a prefix language.

Common questions

Question: Can I only block pages with a certain parameter?Answer: This file is not enough. It only matches the prefix of the path, and the query parameters cannot be precisely expressed in the prefix rules. You need to use another mechanism or process it on the server.

Question: If there is no error when writing the regular expression, does it take effect?Answer: No. No error does not mean the format is accepted, regular expressions are treated as literal prefixes and cannot match the target path. Check the match results instead of relying on syntax passing.

Question: If the crawling file is blocked, will the content not be crawled?Answer: No. The protocol itself acknowledges that the crawling party can ignore this statement, which is an intention rather than a requirement. The real content to be protected should fall on the server's permissions and frequency limits.

Related articles

The content management system released several security versions in a month, indicating what operation and maintenance should change.

The content management system released security maintenance versions consecutively within a month, indicating that the operational judgment criteria should shift from version numbers to the content of repairs. This article takes recent public information as an example: WordPress released three security maintenance versions consecutively in September and October, Joomla released security fixes for both 5.x and 6.x at the same time, from which three operational adjustments can be extracted - decide based on the content of repairs, leave a rollback point for upgrades, and rotate keys and passwords after upgrades.

2026-10-12

Where do the differences in costs lie between self-built content systems and pay-as-you-go cloud services?

Self-built content system and pay-as-you-go Headless cloud services, the main cost difference lies in the four items of servers, request volume, integration expansion, and operation and maintenance personnel. Self-building on a small scale is usually more cost-effective, while maintenance and personnel become the main expenses as the scale increases; Headless deploys the front-end to the edge, retrieves content by interface, eliminates server-side rendering for each request, but introduces interface call billing. This article compares the four items and provides a comparison with self-hosting.

2026-10-12

What can unlogged-in users read, where are the permission boundaries of the content system likely to leak?

What can unlogged users read depends on where the permission boundary is drawn. Most unauthorized access is not in the main article itself, but in附属 data, interface lists, and preview entries: comments, attachments, and draft previews all have their own visibility. This article explains the three most easily overlooked positions and the methods of closing with in-station user group permissions, document status, and default closure of high-risk interfaces.

2026-10-12

Injections can also be hidden in exported files, where can the prevention of second-order SQL injection be found?

The feature of second-order injection is delayed execution: malicious content looks harmless when written for the first time, but triggers only when exported, imported, or rebuilt as a statement to be consumed. This article takes the second-order SQL injection in the WXR export fixed in WordPress 7.1.3 as an example, explaining the difference between first-order and second-order, why export has become a delivery channel, and where to place protection in the steps of writing, storing, and consuming, as well as the checks to be added to the backup and recovery process.

2026-10-12

Should crawling be allowed on list pages with filtering parameters, and how to write the exclusion path?

Should the list page with filtering parameters allow crawling, and it needs to be judged separately according to the page type. This article first distinguishes three types: in-site search, custom field filtering, and pseudo-static surface address, and then according to the crawling exclusion protocol, only recognizing the path prefix as the restriction, it explains which should be blocked and which blocked would hurt the collection, as well as how to divide the work of excluding paths at the in-site robots configuration and pseudo-static rules.

2026-10-12

When an intelligent agent requests a plain text version via the request header, at which layer should the site conversion be done?

When an agent uses the Accept request header to request a plain text version, the conversion is usually done by the edge layer instead of the source site itself. This article explains the negotiation mechanism: the client expresses preferences in the header, the edge retrieves the original web page from the source site and dynamically converts it to Markdown, the type header and cleaning scope returned are determined by the conversion party; the original security headers of the source site are transmitted, but the length, entity identifier, and modification time headers are removed. It also explains the three things that need to be confirmed within the site and the division of labor in the model description file.

2026-10-12

How to choose when the edge node handles text conversion and the program generates a plain text version for website construction?

Two paths are available to provide an intelligent agent with a plain text version: converting at the edge node, where the source station does not modify the code but is constrained by the hosting slot and volume limits, and the granularity of control in the response header; or the program outputs plain text itself, with content and structure control but with additional template and caching costs. This article discusses the control surface, volume, and consistency differences between the two paths, and provides suggestions for four types of website scenarios and four questions to ask.

2026-10-12

The longest validity period of the certificate is reduced to two hundred days, which parts should be changed first for renewal and monitoring

The longest validity period of the subscription certificate has been reduced to two hundred days, and it will continue to be shortened to one hundred days and forty-seven days. The reduction in validity period does not affect access itself, but it affects the renewal frequency: renewal window, expiration reminder objects, and deployment layer replacement methods. These three places need to be changed accordingly, and the monitoring threshold also needs to be changed from weekly to daily. This article provides the sequence of changes and one that is easy to overlook.

2026-10-12