Optimize URL structure, create personalized website links: AnQiCMS Static Rule Configuration Guide

In website operation, URL (Uniform Resource Locator) is not only the address of the content, but also an important part of search engine optimization (SEO) and user experience (UX).A clear, meaningful, and memorable URL structure that can effectively improve a website's ranking in search engines, as well as allow visitors to understand the page content more intuitively.AnQiCMS as an enterprise-level content management system, provides powerful static rule configuration functions, helping you easily achieve personalized URL display.

Why are static rules so important?

The traditional dynamic URL often contains question marks, equals signs, and complex parameters, such asyourdomain.com/view.php?id=123&category=newsSuch a URL is not conducive to search engine crawling and indexing, and is also difficult for users to remember and share.The core of pseudo-static technology lies in converting these dynamically generated URL addresses through the server's URL rewrite module into URLs that appear static but are actually still dynamically generated by the program, for exampleyourdomain.com/news/123.html.

The pseudo-static feature of AnQiCMS was born to solve this pain point. It can help your website have a more friendly URL structure, thereby bringing many benefits:

  • Improve SEO effectiveness:Search engines tend to crawl and index static or pseudo-static URLs because they believe that the content pointed to by these URLs is more stable and authoritative.A clear URL includes keywords and also helps search engines understand the page topic.
  • Improve user experience:A concise and meaningful URL makes it easy for users to understand, remember, and share.
  • Enhance website security:Hide dynamic parameters, to some extent, it can also reduce the risk of malicious attackers injecting through URL parameters.

Flexible selection: AnQiCMS built-in pseudo-static mode

AnQiCMS understands the diversity of user needs and therefore provides a variety of built-in modes for setting up pseudo-static rules, so that you can quickly enable them according to the type and content characteristics of your website.These preset modes are located under the "Function Management" menu in the background, click "Static Rules" to enter the configuration interface.

You will see the four built-in pseudo-static rules of the system:

  1. Numeric mode:This is the most common pattern, document details, document lists, single-page details, and tab pages, etc., will be based on their ID as the basis for generating URLs. For example, the URL of an article may be/archive/123.htmlThis pattern is concise and clear, especially suitable for Chinese websites.
  2. Model naming pattern:In this mode, the URL will contain the English alias of the content model. For example, the alias for the article model may bearticleThen the URL of the article detail page may be displayed as/article/123.htmlOr/article/your-article-name.htmlThis is very suitable for English stations or websites that want to have a more descriptive URL structure.
  3. Category naming pattern 1:The URL may contain category pinyin alias or custom English alias. For example, an article under the news category may have a URL like/news/123.htmlThis pattern can intuitively display the content attribution, which is helpful for users to understand the website structure, and is also applicable to Chinese websites.
  4. Category naming pattern 2:This pattern is similar to category naming pattern 1, but may have slight differences in URL structure, and is usually used on English sites to organize URLs by category alias.

Selecting these built-in modes is very simple, just check the modes you want to enable in the list and then save the settings.For most users, these built-in patterns can already meet the daily needs of website operations.

Advanced customization: Customize the rewrite rules to create a unique URL

If you have more refined needs for URL structure, AnQiCMS also provides a powerful "custom mode".This allows you to fully control the website's URL generation method, achieving highly personalized link display.

Configure the steps for custom rewrite rule:

  1. Enter the rewrite rule setting interface:Log in to the AnQiCMS backend and navigate to the 'Function Management' under the 'Static Rules' page.

  2. Select 'Custom Mode':Above the page, switch the static rules type to "custom mode". At this time, the six groups of rule configuration areas for editing will appear below.

  3. Understand the structure of the rules and the available variables:Each rule of the custom pattern must be followed规则名===规则值in the format. The system provides six types of rule names, each corresponding to different types of content pages:

    • archiveUsed for the detail page of documents (such as articles, products).
    • categoryUsed for the category list page.
    • archiveIndexUsed for the homepage of models (such as article models, product models), which is the summary page of all documents of the model.
    • pageUsed for single pages (such as "About Us", "Contact Us").
    • tagIndexUsed for the tag homepage, which is the summary page of all tags.
    • tagUsed for the document list page under a specific tag.

    In规则值In Chinese, you can flexibly use the following variables to construct the URL structure:

    • {id}: The unique numeric ID of the content, such as article ID, category ID.
    • {filename}Custom URL alias for content. When editing documents, single pages, or tags, you can specify an English or Pinyin alias for it in the 'Custom URL' field.If this variable is enabled, make sure that the corresponding content has set this alias, and it is unique throughout the site.
    • {catname}Custom category URL alias. It can be set in the "Custom URL" field when editing the category. And with{filename}Similar, enabling this variable also requires that the category has been set with an alias and maintains uniqueness.
    • {catid}Unique number ID for the category.
    • {module}: The English table name or URL alias of the content model. For example, the default URL alias for the article model is usuallyarchiveorarticle, the product model could beproduct.
    • {page}: Page number. This variable usually needs to be enclosed in parentheses()to indicate that it is optional and will only be displayed when pagination is present. For example,(-{page})indicating that pagination is present if it exists-2/-3etc.
  4. Write and apply rules:After mastering the rule names and variables, you can start building your own URL structure. For example, here is a common custom rule example:

    archive===/{module}/{id}.html
    category===/{module}/list-{catid}(-{page}).html
    archiveIndex===/{module}/index.html
    page===/{filename}.html
    tagIndex===/tags(-{page})
    tag===/tag/{filename}(-{page})
    
    • archive===/{module}/{id}.htmlIndicates that the URL of the article detail page will be内容模型别名/ID.htmlFor example/article/123.html.
    • category===/{module}/list-{catid}(-{page}).htmlIndicates that the URL of the category list page will be内容模型别名/list-分类ID.htmlIf pagination exists, then内容模型别名/list-分类ID-页码.htmlFor example:/article/list-10-2.html.
    • page===/{filename}.html: The URL of a single page will be its custom URL alias, for example/about-us.html.
    • tag===/tag/{filename}(-{page}): The URL of a list page for a specific tag will be/tag/标签别名.htmlIf pagination exists, then/tag/标签别名-页码.html.

    When setting a custom URL, make sure the URL alias ({filename}and{catname}) You have correctly filled in the content and category editing interface. If not set, the system will not be able to generate the corresponding URL correctly, which may cause the page to be inaccessible.

  5. Save and update the cache:After setting up the rules, be sure to click the "Save" button. To make the new rules take effect immediately, it is recommended that you go to the "Update Cache" feature in the background and clear the website cache.

The key to configuring the server environment

In addition to configuring the pseudo-static rules in the AnQiCMS background, your server environment (such as Nginx, Apache) also needs to be configured accordingly to ensure that all access requests are correctly