Optimize URL structure, create personalized website links: AnQiCMS Static Rules 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).An clear, meaningful and easy-to-remember URL structure can effectively improve the ranking of the website in search engines, and also make it easier for visitors to understand the content of the page.AnQiCMS as an enterprise-level content management system, provides powerful pseudo-static rule configuration features to help you easily implement 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=news.This URL is not conducive to search engine crawling and indexing, and it is also difficult for users to remember and share.yourdomain.com/news/123.html.

AnQiCMS's pseudo-static feature is designed to address 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 such URLs is more stable and authoritative.The clear URL includes keywords and also helps search engines understand the page topic.
  • Improved user experience:A concise and meaningful URL makes it easy for users to understand at a glance, convenient for memory and sharing.
  • Enhance website security:Hide dynamic parameters can also reduce the risk of malicious attackers injecting through URL parameters to a certain extent.

Flexible selection: AnQiCMS built-in pseudo-static mode

AnQiCMS knows the diversity of user needs, and therefore provides a variety of built-in modes for pseudo-static rule settings, so that you can quickly enable them according to the type of your website and its content characteristics.These preset modes are located under the "Function Management" menu in the background. Click on "URL Rewrite Rules" to enter the configuration interface.

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

  1. Digital Mode:This is the most common pattern, where document details, document lists, single page details, and tabs, etc., are generated based on their ID as the URL. For example, the URL of an article might be/archive/123.htmlThis mode 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 might bearticle, then the URL of the article detail page may be displayed as/article/123.htmlor/article/your-article-name.html. This is very suitable for English sites or websites that want a more descriptive URL structure.
  3. Category naming pattern 1:The URL will include the pinyin alias or custom English alias of the category. For example, a news article under the news category may have a URL like/news/123.htmlThis pattern can directly show the content ownership, which is helpful for users to understand the website structure, and is also suitable for Chinese sites.
  4. Category naming pattern 2:This pattern is similar to the classification naming pattern 1, but may have slight differences in URL structure, and is usually used on English websites to organize URLs by classification 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 are already able to meet the daily website operation needs.

Advanced Customization: Customize rewrite rules to create a dedicated URL

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

Steps to configure custom rewrite rules:

  1. Enter the rewrite rules settings interface:Log in to the AnQiCMS admin panel, navigate to the 'Function Management' under the 'URL Rewrite Rule' page.

  2. Select 'Custom Mode':Above the page, switch the pseudo-static rule type to "Custom mode". At this time, the lower part will appear with six groups of rule configuration areas available for editing.

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

    • archive:Used for the detail page of documents (such as articles, products).
    • category:Used for the category list page.
    • archiveIndex:Used for the homepage of the model (such as article model, product model), which is the summary page of all documents of the model.
    • page:Used for single pages (such as “About Us”, “Contact Us”).
    • tagIndex:Used for the tag homepage, that is, the summary page of all tags.
    • tag:Used for the document list page under a specific tag.

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

    • {id}:Content's unique numeric ID, such as article ID, category ID.
    • {filename}The custom URL alias of the content.When editing a document, a single page, or a tag, you can specify an English or pinyin alias for it in the "Custom URL" field.If this variable is enabled, make sure the corresponding content has set this alias and is unique throughout the entire site.
    • {catname}:Category custom URL alias. It can be set in the 'Custom URL' field when editing the category.{filename}Similar, enabling this variable also requires that the category has been set with aliases and they remain unique.
    • {catid}:Categorization unique numeric ID.
    • {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 may beproduct.
    • {page}:Page number. This variable is usually enclosed in parentheses.()enclosed to indicate that it is optional and will only be displayed when pagination is present. For example,(-{page})indicates that the page number will be displayed if pagination is present.-2/-3etc.
  4. Write and apply rules:After you have mastered the rule name and variables, you can start building your own URL structure. For example, the following 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}.html:Represents the URL of the article detail page will be内容模型别名/ID.htmlfor example/article/123.html.
    • category===/{module}/list-{catid}(-{page}).html:Represents the URL of the category list page will be内容模型别名/list-分类ID.html,if pagination exists,内容模型别名/list-分类ID-页码.html。For example/article/list-10-2.html.
    • page===/{filename}.html:The URL for a single page will be its custom URL alias, for example/about-us.html.
    • tag===/tag/{filename}(-{page}):The URL for a list page of a specific tag will be/tag/标签别名.html,if pagination exists,/tag/标签别名-页码.html.

    When setting a custom URL, please make sure the URL alias{filename}and{catname})In your content and category editing interface, the information has been filled in correctly. If not set, the system will not be able to generate the corresponding URL correctly, which may lead to the inability to access the page.

  5. Save and update the cache:After completing the rule settings, 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 to clear the website cache.

The configuration of the server environment is critical

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