Practical configuration of static URL and 301 redirection
Configure static rules and 301 redirect in AnQiCMS in two steps: first, determine the address style and enable the rules in the background static rule management, so that the column pages and content pages can be accessed with readable addresses; then, use 301 redirect to point historical addresses one by one to the new standard addresses. Both work together, and the revised site will not lose the inclusion and external link weight due to address changes.
Understand the problem to be solved first
The page of the content management system is dynamically rendered, but the address exposed to the outside should not contain a string of query parameters. The role of pseudo-static is: visitors see/blog/123.htmlThis kind of stable address, the program still retrieves data according to the original logic internally. There are three benefits: readable address, easy to crawl, and parameters are not lost when copied and shared
301 redirect solves the problem on the timeline: changing the column name, changing the article classification, and migrating from the old system will leave invalid or duplicate old addresses. 301 tells the search engine 'The content has moved, and the weight is recorded on the new address.'
The order of configuring pseudo-static rules
AnQiCMS supports static rules management, and you can customize the static URL. It is recommended to operate in this order to avoid redoing the work:
- Determine style: Decide the form of columns, content, categories, and tags first, and unify the entire site;
- Enable rules: Enable the corresponding rules in the background and save them item by item;
- Check the homepage: After clearing the cache, visit the homepage, column page, and content page once each;
- Check submissions: After generating the site map, check several URLs to confirm that they are consistent with the rules;
- Check robots: Confirm that robots.txt does not block the newly generated directory format.
Try to make each rule correspond to a type of page, and ensure that rules do not produce ambiguous matches. Once an address is determined and released, it should not be frequently changed. Changing it once requires updating a batch of 301 redirects.
Configure 301 redirect
AnQiCMS provides 301 redirect management, used to set URL redirection. Three types of scenarios are worth registering one by one:
- Revision residue: the old column address points to the new column page;
- Content merging: the deleted address points to the retained article after merging multiple articles on the same topic;
- Address normalization: addresses with parameters, differences in slashes, and case differences are unified to point to the standard version.
When performing batch migration, first export the old address list into a table, label each new target item by row, and then enter the redirect rules. After going live, verify by sampling to ensure the return status code is 301, not a soft redirect of 302 or 200.
Common faults and troubleshooting
| Phenomenon | Check first |
|---|---|
| Page 404 | Whether the pseudo-static rules are enabled, and whether the Web server rewrite module is effective |
| The address jumps back to itself | Two rules point to each other to form a loop, delete one of them |
| Multiple addresses on the same page can be accessed | Lack of normalization 301, the weight is分流 |
| Changes do not take effect | Cache not cleared, or the rule saving order has overwritten the previous one |
Looping redirects are the most need to be vigilant: A points to B, B points back to A, browsers and crawlers will interrupt the grab. With each additional 301, make sure the target address itself does not produce any jump.
Regular wrap-up
Rules are not finished after configuration. Do a cleanup once a quarter: Supplement redirect or confirm complete deletion of 404 addresses appearing in the access log; take down old rules that are no longer accessed; check that the sitemap and robots'口径 are still consistent.
Common questions
What is the difference between pseudo-static and real static?Static will generate an actual HTML file, while pseudo-static only rewrites the address level, and the content is still rendered by the program, with lower maintenance costs.
Will changing the address affect the existing ranking?Yes, it will, so it must be paired with 301 item-by-item migration instead of allowing the old address to directly 404.
Is it better to have more rules?No, redundant rules can lead to ambiguous matching and difficulty in troubleshooting, and it is more stable to simplify the configuration according to the type of page.