Where is the Robots file located, what can it control, and what can it not control?
Where should the robots.txt file be placed on a website, what can it control, and what can it not control? The location is the root directory of the site, there is no other choice; the boundary of its ability is 'control crawling', not 'control indexing'. Many sites have problems exactly on these two points: the file is placed in the wrong level, causing the rules to be completely ineffective, or the content that should not be made public is given to it to hide. Understanding what it controls and what it does not control can help determine whether the problem is with crawling or content during collection and troubleshooting.
Why must the location be in the root directory only
The file lookup method is fixed: when the crawler accesses the site, it first takes this one according to the root path and will not go to the secondary directory or sub-site directory. Placed in /static, /admin, or some sub-directory, it is equal to not taking effect.
This is more likely to go wrong when deploying multiple sites: the same program is hung on multiple domains, and each domain must have this file under its own root directory, and the rules cannot be borrowed from each other. Writing restrictions for the main station does not mean that the branch stations also have the same restrictions.
It can manage two things
The first is path visibility: declares which paths are allowed to be crawled and which are not, the rules apply to all files under the path. The second is the crawling rhythm, which tells the processor how long to wait between requests through an independent request header field, used to control the access pressure on the server.
AnQiCMS has made this item a background configurable SEO setting, which takes effect directly after modification, without the need to manually change the files on the server - this is very useful for websites that frequently adjust rules, as it reduces the cost of making mistakes.
The three things it cannot control.
The first is a page that has already been publicly linked. Restricting crawling only prevents it from taking content, but if the page has external links pointing to it, it may still appear in the results. Moreover, since no text is retrieved, the abstract displayed may be even more uncontrollable. To truly control whether it is included, you need to use meta tags or response headers within the page, which belongs to another path.
The second is access permissions. It is not an authentication mechanism, anyone who opens this file can read the paths written inside, and listing the background directory, test directory, etc. is like giving out a map to outsiders.
The old address that has already been distributed. After the upgrade, the old link direction needs to be handled by 301 redirect, and relying on limiting crawling will only allow the old and new addresses to coexist for a longer time.
How to write the line pointing to the sitemap
The location of the sitemap can be declared in the file, written as a separate line to provide the complete address of the sitemap file. Pay attention to three things: this address must be accessible directly; it points to the currently effective version, do not keep the old domain after the upgrade; multi-site each declare their own version.
The common mistake is to block the crawling of the site map file directory in one piece, resulting in the declaration line pointing to an inaccessible address, creating contradictions on both sides, making the site map virtually non-existent. Whether the declaration overrides the restriction depends on the path matching, and only two points need to be checked when inspecting: the site map address itself is accessible, and it is not under any restriction path.
Drafts and content to be published should not be hidden by it.
Drafts, pending publications, and items in the recycling bin should not be visible to the public. Writing their paths into restriction rules is the most convenient approach, but not safe: once links are sent out, they may leave traces elsewhere, and crawl restrictions will not take the page offline.
A more stable approach is to control from the status: drafts and pending publications do not generate accessible addresses to the public, previews go through dedicated links with preview parameters, and the default crawl side does not enter the list; sitemap and link push only output formal documents. In this way, active push and new address submission will not push out unfinished content, and it is not necessary to pile rules in this file.
Common questions
Why can't I access this file in the root directory? It's mostly because the pseudo-static rules have eaten up the request, or the site is deployed in a sub-path. First, access directly to confirm that the return status code is successful and not redirected or rewritten to the homepage.
Will limiting crawling affect the weight? It doesn't directly affect ranking, it only determines whether content can be retrieved. To control display and indexing, go the route of meta tags or response headers within the page.
How often should you check? You should review it after changing path rules, adding sub-sites, and launching new modules, and check once a quarter normally.