What are the conventions of Disallow, asterisk, and dollar sign in robots.txt?
What do Disallow, wildcard asterisk, and trailing dollar sign at the end of a line represent in robots.txt? This set of rules is defined by the standard document RFC 9309: The basic instructions are Allow and Disallow fields, which respectively indicate the paths to be allowed and disallowed for crawling; the asterisk is a wildcard, matching any segment of characters; the dollar sign at the end of the line indicates that the address matches exactly to this position. Understanding these conventions can cover most of the reading and writing needs for daily crawling rules.
The scope of the two basic instructions.
Allow and Disallow are both objects of 'user group + path prefix': files are segmented by user group (the most common wildcard crawler), and within each segment, declare which paths are allowed and which are prohibited. By default, paths that are not declared are unrestricted; Disallow points to a directory, meaning that all addresses with the prefix are excluded.
Two easily confused boundaries: The Disallow for null values means 'nothing is prohibited', that is, the entire user group can follow the convention of the entire site; when the same path is covered by both Allow and Disallow, the more precise (longer prefix) one takes effect, which is a clear matching idea in the standard, and has nothing to do with 'the one written first has priority.'
Standardization of wildcards and tail symbols
The asterisk solves the matching of 'indefinite length in the middle': For example, if you want to exclude all list pages with sorting parameters, you can use an asterisk to replace the parameter segment in the path. The dollar sign solves the 'stop here' exact matching: After adding a dollar sign at the end of the line, the rule only matches the address that ends at this position, and any longer address with any suffix is not affected. Combined, they can express the 'exclude bare directories without suffixes, while retaining their suffix pages' such fine-grained intentions.
| Writing fragment | Meaning | Typical use |
|---|---|---|
| Disallow path | Prohibit all addresses under this prefix | Exclude background and internal tool directories |
| Allow path | Explicitly allow a certain prefix | Release individual public pages under prohibited directories |
| Asterisk | Match any character sequence | Override address segment with parameters |
| Dollar sign at the end of the line | Address ends exactly here | Only match bare addresses without query parameters |
Note that the dollar sign only affects the end judgment, not the regular expression engine - if you want to write complex regular expression logic, you will be disappointed. The standard matching syntax only has these two types of wildcards with prefixes.
Why does it only constrain crawling, not inclusion?
robots.txt controls whether to crawl or not, regardless of whether it will be indexed after being crawled. Pages that have been prohibited from crawling may still appear in the index due to external links (the engine only indexes addresses and does not retrieve the text), which is the most common misunderstanding. To completely exclude a page from search results, you need to rely on page-level control or access permissions, not just write a line in robots.txt. Similarly, robots.txt is a gentleman's agreement and has no binding force on bulk collectors who ignore the agreement - to prevent content from being taken whole, you need to use other anti-crawling measures.
There is also a safety red line: do not hide sensitive background addresses in Disallow. Public files mean that the existence of this path has been announced to everyone, and exposing the entry is more likely to be targeted for testing. The protection of the background should be based on authorization and access control.
Where is the robots configuration entry and when to review it inside the site?
AnQiCMS supports robots configuration, the background modification is generated to the root directory of the site. There are two times to actively check the robots rules: one is after changing the pseudo-static rules - the address form has changed, the original exclusion rules written according to the path prefix may no longer match, or may inadvertently damage the public pages of the new format.After the structure adjustment of the column - the old prefixes that were excluded may have been replaced with new ones, and the rules may be disconnected from the actual route. The review method is very direct: take the rule list and compare it with the representative addresses in the current site map one by one, confirming that each Disallow still only blocks the intended address.
Common questions
How long does it take for the change of robots to take effect?It depends on the time when each engine next fetches the file, there is no immediate push; eager inclusion actions with link push are more effective than waiting for the file to be re-fetched.
Can different rules be written for different user group segments?Can, limit separately by engine user group, but verify the matching results of mainstream crawlers, to avoid only testing wildcard segments.
Where should the Sitemap declaration be written?It can be written in the robots file to point to the Sitemap address, which is to give it 'directions', and it does not conflict with allowing or blocking crawling.