When picking rule groups, the crawler does not pay attention to case, but the path rules do, and you may step on which part during configuration.
When choosing the rule group, the crawler does not pay attention to case, but the path rules do, where will it step on when configuring? Stepping on the path. In RFC 9309, the matching of the product identifier is mandatory case-insensitive (Crawlers MUST use case-insensitive matching to find the group that matches the product token), while the path matching explicitly states The matching SHOULD be case sensitive.The result is: The case is arbitrary when writing User-agent, and /Upload/ and /upload/ are two different rules when writing paths, blocking one does not mean blocking the other.
The protocol only recognizes two commands
The grammar is defined as follows: rule = *WS (“allow” / “disallow”) *WS “:” *WS (path-pattern / empty-pattern) EOL. That is to say, the instructions at the protocol level are only allow and disallow, with values being path patterns or empty patterns. Any line other than this is not within the constraints of this grammar.
Check the identifier for selection, and check the path for hits
The rules are grouped by product identifiers: the crawler first uses its own identifier to match the various User-agent groups. This step does not distinguish between uppercase and lowercase, Googlebot and googlebot belong to the same group. After selecting the group, the path comparison begins, and the path matching SHOULD distinguish between uppercase and lowercase, as the filenames on the server are often distinguishable. These two steps use different case strategies, which are not arbitrary in protocol design but according to the rules when configuring.
Who wins in a conflict: Take the **body based on the number of bytes
When both 'allow' and 'deny' can match the same path within a group, the criterion is 'The most specific match is the match that has the most octets', which means the one with the most matching octets wins.Pay attention to the unit being octet (byte) rather than character: Non-ASCII directories occupy multiple bytes per character in common encodings, and Chinese paths appear short but have more bytes, which is easily misaligned with the intuition that 'the longer it is, the more specific it is.'When determining the conflict result, consider the byte length after encoding, not the number of characters on the screen.
What else is written outside the protocol
The protocol leaves a loophole for additional records: Crawlers MAY interpret other records that are not part of the robots.txt protocol – for example, “Sitemaps”.This sentence has two meanings. One is that sitemap records are indeed often written in the same file, but their interpretation depends on each implementation and is not an obligation stipulated by the protocol.Similarly, instructions like noindex, crawl-delay and others fall into the range of 'explainable or not' in the sense of 'rules', and inconsistent effects across engines are normal. When it is necessary to block, it should be based on the path rules, and do not place critical control on the extension lines.
How to align this set of rules within the site
The Robots.txt configuration is managed centrally in the background, and it should be written according to the two sets of case sensitivity strategies of the protocol: the paths to be blocked are distinguished by case, and the actual directory is called what it is written as.The more common source of conflict is the URL format itself - AnQiCMS supports custom pseudo-static rules for pseudo-static URLs. After changing the rules once, it is necessary to go back and check whether the paths in the crawling files still point to the same format, otherwise there may be gaps where the rules written are for old paths while the online paths have been changed to new ones.The address in the site map must be the same as the path in the crawling rules: If the automatically generated address in Sitemap is different from the actual access path online in terms of case, the map can be accessed but the content is blocked by the rules. This type of problem is reflected in the logs as normal crawling records but dropped inclusion.
Common questions
Ask: Should only one disallow directive be written for directories with different cases?Answer: Write them separately. Path matching is case-sensitive, and the two formats match different resources; writing one means missing one.
Ask: Is disallow prioritized in conflicts?Answer: No. The protocol matches the **body, comparing the number of bytes matched, and it is unrelated to whether the instruction is allow or disallow.
Ask: Must the sitemap be written in the crawl file?Answer: It is not mandatory. It belongs to a common extension interpretation outside the agreement, and it is a safe practice to register at the map submission entrance at the same time, not relying solely on this line.