Why does the program overwrite the entire site configuration file when saving settings, and why does it overwrite the rules I added myself?

📅 October 12, 2026 👁️ 18

When saving the settings, the site configuration file is rewritten in whole, and the manually added rules will disappear. This is because such directory-level configuration files have only one copy, and the program's write logic generates the entire template without reading and retaining the existing content. This is not because the configuration was written incorrectly, but because ownership has not been divided: both the rewrite rules generated by the program and the custom entries added by operations are placed in the same file, and either party's entire write will cause the other to lose.

Why do the rules disappear after a certain save

The typical phenomenon is: after changing the pseudo-static switch in the background or saving the site settings once, all the previously added access restrictions, redirects, and caching rules are gone. The corresponding fix can be found in the implementation of peers, and in the update record of PbootCMS V3.2.26, it is stated that the fix is for Apache misjudging the environment when enabling pseudo-static, causing the site directory configuration file to be overwritten each time it is saved.The value of this record lies in clarifying the cause: the program made a judgment error before generating rules, treating scenes that should not be rewritten as those that need to be rewritten, so every save triggers the entire writing.

The ownership issue of directory-level configuration files

The location of this type of file is under the site directory, the scope of action is this level and its sub-levels. It can carry a variety of content such as rewrite rules, access control, error page redirection, cache parameters, etc., where both the program and operations staff write. To avoid overlap, it can only be divided according to ownership:

  • The part managed by the program: pseudo-static rewrite rules, path mapping bound to the site structure;
  • The part managed by operations: manual redirection, access restrictions, security-related parameters, cache and compression strategies;
  • Parts that both need to read but cannot write simultaneously: the behavior definition of the site root path, you need to confirm which party is the authoritative source before making changes.

How to separate the maintenance of both sides

There are three feasible ways to divide, and the common point is that the program only writes its own part

The method. Specific arrangement Advantage Points to note
Upper definition, do not place the lower layer Write the operation and maintenance rules outside the main configuration of the site, and leave the directory-level files only for the program Writing the entire program does not affect the operation and maintenance entries Host configuration permissions are required, and it is often not available on shared hosts
Program writes an independent segment Let the rewrite rule point to a separate file, and leave the operation and maintenance rules in the original file Each side should write one, without overlapping The program upgrade may revert to the whole write, and it needs to be rechecked
Manual entries are incorporated into program management Maintain redirection and rules through the back-end entry, generated uniformly by the program There is only one authoritative source, it will not be lost Expressiveness is limited by the range of back-end functions

AnQiCMS's pseudo-static rules are managed by the program, support custom pseudo-static URLs, the rewrite entries of the site are configured according to the rules instead of manual editing of directory files. Taking the third path is more stable, but the cost is that complex conditions depend on the back-end providing enough expressiveness.

Verification list after the modification is complete

The first step is to make a backup before making changes. The built-in backup capabilities of the program should cover data and static files, and without this step, it would be very difficult to recover from a single accidental overwrite. The second step is to copy the files in the current directory item by item into a list, save the settings first, and then compare them item by item to see which types of rules are missing, and determine the range of write coverage.The third step, use a test to confirm the trigger condition by not modifying any options and just saving: if the entire file is rewritten but the content is consistent with before, it means the write is unconditional;If the content changes, it means the program is regenerating according to the template. Step four, verify that the pseudo-static effect and manual entries take effect at the same time - request an address within a rule and an address outside a rule separately.Step five, record this difference in the deployment document, and run steps two and three again after each program upgrade, as the write range is a part that is easily changed by version updates.

Common questions

Can it be set to read-only to prevent the program from writing? Answer: The save operation will fail directly, as the program considers writing rules as part of the save process. A more feasible approach is to move the operation entries to a position where the program does not touch them.

Why would local be normal and online lose rules? Answer: Most differences are in environmental judgment. The program needs to know which server the site uses and whether rewrite is enabled, and when the judgment conditions are not met, it will go to the whole generated branch.

How to quickly recover after the manual jump is overwritten? Answer: Restore from backup, then change the jump to the upper configuration or the redirection entry provided by the background, to avoid falling into the file rewritten by the program again.

Related articles

What is the situation when the login credentials are partitioned by the top-level site when embedded by other sites?

Login credentials with partition attributes are stored separately by the top-level site: one is read when the same address is accessed directly, and another is read when the page is embedded by other sites, and they do not share. The official document states that this attribute indicates that credentials should be stored using partitioned storage, and it must be set at the same time as the security mark, and it is recommended to bind the credentials to the host with a hostname prefix name instead of a registrable domain. If the site assumes that the login state is globally shared, it will not be read in the embedded scenario.

2026-10-12

In the front-end monitoring, the loading time of cross-domain images is all zero, which response header should be added

The loading time of cross-domain images is read as zero in the front-end monitoring, the missing is the timing pass response header. The official document defines: this header specifies which sources are allowed to see the attribute values obtained through the resource timing interface, otherwise these values will be reported as zero due to cross-domain restrictions. The value can be a wildcard to release all sources, or a comma-separated list of sources. It only affects timing readings and does not change the access permissions of the resources, so adding this header solves the attribution problem, not the access problem.

2026-10-12

The intermediate response code for pre-loading resources on the first screen, why is it only issued in multi-path multiplexing protocols in most cases?

The 103 intermediate response used for pre-loading resources on the first screen is a prompt issued by the server before it organizes the final page, allowing the client to pre-connect or pre-load resources. The official documentation suggests that for compatibility and security reasons, it should only be sent in HTTP protocol version 2 or higher, as most browsers only support it under these conditions. The reason is that under old protocols, the boundary handling between intermediate responses and final responses is inconsistent, which is easy to confuse with the content of waiting responses.

2026-10-12

How to check the status code conditions and inheritance level when the security response header is added but not present in some responses?

The security response header is added but not visible in some responses, usually stuck at two places: first, the header addition instruction only takes effect for specific response codes, the effective codes listed in the mainstream Web server documentation include two hundred successful segments and three hundred redirects, non-successful responses need to be added unconditionally with the always parameter; second, the hierarchical inheritance rule - once the header addition instruction is defined at the same level, the entire set of definitions at the upper level no longer inherits. The troubleshooting sequence is to first reproduce the response code missing the header, and then locate which level of configuration generates it.

2026-10-12

The explicit specification of an index in a list query is actually slower, in what situations will it degrade to a full table scan?

Writing a fixed index hint in a list query is equivalent to letting the optimizer give up the opportunity to choose a path based on statistical information: when the hint points to an index that does not match the current conditions, the query that could have used a covering index or range scan will be pushed to a more costly execution method, and further degraded into a full table scan when the conditions fail. The same program PbootCMS has fixed the issue of list tags degrading to a full table scan due to index hints in the update records of V3.2.26, and has unified the new libraries to be indexed by the title field.

2026-10-12

Why should the database script in the online upgrade be arranged in version order, and what should be done if it fails halfway

The database script for the online upgrade must be executed strictly in the order of version numbers, as each script is based on the premise that 'the previous one has been completed': the new field has not been created, and the next one will fail when writing values. Skipping intermediate versions during cross-version upgrade will leave the table structure halfway. If the script fails halfway, the safe approach is to stop immediately and leave a log, rather than ignoring the error and continuing to run the remaining scripts, otherwise the problem will be covered by the subsequent scripts. Make a backup of data and static files before the upgrade, and check each section after the upgrade.

2026-10-12

Why would the entry be lost and keep getting bigger when writing the intercept list to a file?

Writing the login intercept list to a single file can easily cause loss of entries under concurrent writing: two requests read the same content at the same time, append their own content respectively, and write it back separately, the latter overwriting the former, and the intercepted addresses thus disappear from the list. Files without a capacity limit will continue to grow, and the time to read and parse will become longer; irregular malformed entries can cause parsing errors directly, resulting in the overall failure of the list. The list is just the first layer, and the server still needs to have independent verification and captcha steps.

2026-10-12

The cause of the core announcement is writing the built-in third-party library, in addition to waiting for the patch, the station also needs to look at which part

The cause is written in the core announcement of the built-in third-party library, the vulnerability is not in the code written by the station itself, but it is distributed with the core, so it cannot be avoided by changing your own template or business code, and can only follow the core version. When following up, read three sections: the upper and lower bounds of the affected range determine whether your version is hit, the fixed version determines which version to upgrade to, and the rating and exploitation conditions determine the priority of scheduling. Taking the Drupal announcement SA-CORE-2026-013 as an example, the affected range spans three branches, and the fixes are in the latest version of each branch.

2026-10-12