How to configure custom rewrite rules to create more SEO-friendly content URLs?

Calendar 81

The importance of URL structure in website operation is self-evident.A clear, concise, and keyword-rich URL not only enhances user experience, making it easier for users to remember and share content, but also significantly optimizes search engine crawling and ranking effects.AnQi CMS knows this and therefore provides a flexible and powerful static rule configuration function to help users create more SEO-friendly content URL displays.

What is the importance of SEO-friendly URL and its significance?

So-called pseudo-static is not a real static page, but refers to the use of server URL rewriting technology to rewrite the address of dynamically generated pages (such asexample.com/article.php?id=123) into an address that looks like a static page (such asexample.com/article/123.htmlorexample.com/web-seo-strategy.html)

This URL format has multiple benefits for SEO:

  1. Improve user experience:Users can roughly understand the content of the page through the URL, making it easier to understand and trust.
  2. Enhance search engine friendliness:Search engines prefer URLs with clear structure and explicit paths, which helps understand the page hierarchy and content theme.
  3. Keyword integration:Can naturally integrate core keywords into URLs, thereby enhancing relevance.
  4. Increase click-through rate:A clear URL in search results may attract more user clicks.

The static function of AnQi CMS is to enable your website to have these advantages.

The static rule options provided by AnQi CMS

AnQi CMS provides built-in pseudo-static rules for users, making it easy to enable quickly. You can go to the background to see the options,“Function Management”the module.“Static Rules”and you will see several preset modes after entering:

  • Numeric mode:The URL primarily uses the ID of the content as an identifier, for example/article/123.htmlThis pattern is concise and clear, suitable for Chinese websites.
  • Model naming pattern:The URL will include the alias and ID or custom name of the content model (such as articles, products), for example/article-123.htmlor/news/seo-guide.html. More semantic, suitable for English or SEO-friendly websites.
  • Categorization naming pattern 1/2:These two patterns add category aliases to URLs, further refining the URL structure, for example./news/web-design/seo-guide.htmlIt helps to clarify the hierarchical relationship of content.

These built-in patterns can meet most needs. But if you have more personalized and fine-grained control requirements for the URL structure, SafeCMS'sCustom ModeIt provides great flexibility.

Deeply customize the static rule configuration

To start configuring the custom static rule, please log in to the Anqi CMS backend and navigate to“Function Management”below“Static Rules”. Here, you will see a name calledCustom ModeThe options, click to select to start your personalized configuration.

Custom mode can set up six groups of pseudo-static rules, each corresponding to different types of pages: document details, document list, model homepage, single page, tag list, and tag details. Each rule is created by规则名===规则值Two parts make up.

Rule name and corresponding page type:

  • archive: Document detail page (such as articles, product details)
  • category: Document list page (such as category page)
  • archiveIndex: Model homepage (such as article center, product center homepage)
  • page: Single page (such as 'About Us', 'Contact Us' pages)
  • tagIndex: Tag homepage (such as a list page of all tags)
  • tag: Tag detail page (such as a content list under a specific tag)

Rule values can include variables:

When defining rule values, you can flexibly use a series of predefined variables, enclosed in curly braces:{}Enclosed by:

  • {id}: Unique ID of the content.
  • {filename}The custom URL alias of content (document, single page, tag), usually the pinyin or English title of the content.
  • {catname}Custom URL alias for a category.
  • {catid}Unique ID of the category.
  • {module}URL alias of content model (such as article, product).
  • {page}Page number.Please note,{page}Variables must be enclosed in parentheses.()Enclosed, for example(-{page})This indicates that this is an optional pagination parameter with a prefix.

Actual configuration example and parsing:

Let's look at a specific example of a custom rule:

archive===/{module}-{id}.html
category===/{module}-{catname}(-{page})
archiveIndex===/{module}.html
page===/{filename}.html
tagIndex===/tags(-{page})
tag===/tag-{id}(-{page})
  • archive===/{module}-{id}.html

    • archive: This rule applies to allDocument detail page.
    • /{module}Indicates that the URL starts with/Followed by the URL alias of the content model (for examplearticle/product)
    • -: A separator
    • {id}.html: The content ID, followed by.htmlas a file extension.
    • Effect example: /article-123.html//product-456.html.
  • category===/{module}-{catname}(-{page})

    • category: This rule applies to allDocument list page(Category page).
    • /{module}-{catname}Indicates that the URL starts with/Starting, followed by the URL alias of the content model and the custom alias of the category.
    • (-{page}): indicates that pagination will be added if it exists.-1/-2Suffix for page numbers; this part is not displayed if there is no pagination.
    • Effect example: /article-news///product-electronics-2/.

Important reminder: Fill in the custom URL field.

In order to{filename}or{catname}This variable takes effect, you need to do it in the background when editing articles, categories, single pages, and tags"Custom URL"Enter the alias you expect. Anqi CMS usually generates pinyin aliases according to the title, but you can manually modify it to ensure the SEO-friendliness and uniqueness of the URL.

  • Uniqueness:Please pay close attention to,{filename}and{catname}The value must be unique throughout the entire site, otherwise the system will automatically add random numbers at the end to ensure its uniqueness.
  • Consistency:It is recommended to use a uniform naming convention, such as lowercase letters and hyphens-Separate words, avoid special characters and Chinese.

Server environment configuration (Nginx/Apache)

After completing the pseudo-static rule setting of the AnQi CMS backend, this is just the first step.In order for these rules to truly take effect on your website, you also need to make the corresponding configuration on your web server (such as Nginx or Apache).The Anqi CMS is essentially a Go language application that typically provides services through reverse proxy.

Nginx server configuration example:

In the Nginx site configuration file, you need to ensure that Nginx can correctly forward pseudo-static requests to the Anqi CMS for processing. The following is a typical Nginx configuration snippet:

`nginx server {

listen       80;
server_name yourdomain.com; # 替换为您的域名
root /www/wwwroot/anqicms.com/public; # 替换为您的网站根目录/public

location @AnqiCMS {
    proxy_pass https://en.anqicms.com; # 这里的端口8001是安企CMS默认监听的端口,如果修改过请对应修改
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_

Related articles

How does the search engine link push feature help new documents be indexed and displayed in search results quickly?

On the day of content release, how can your meticulously crafted website content be quickly discovered and indexed by search engines, which is a focus for every content operator.A newly released article or product page, if it can appear quickly in the search results, it will undoubtedly seize the initiative and bring valuable early traffic.AnQiCMS (AnQiCMS) fully understands this need and has specially provided a search engine link push feature to help your new document reach the search engine as quickly as possible, thereby speeding up indexing and display.Why is it important to be indexed quickly?

2025-11-08

How to correctly insert mathematical formulas and flowcharts in a Markdown editor and ensure they display normally on the web?

In content creation, especially in fields involving technology, science, or complex concepts, we often need to insert mathematical formulas or draw flowcharts to assist in explanation.The Markdown editor of AnQiCMS (AnQiCMS) has provided us with great convenience, allowing these complex elements to be input in a concise text form and presented elegantly on the web.How should we operate specifically to ensure that the content is displayed correctly?Firstly, make sure that your safety CMS system has enabled the Markdown editor.

2025-11-08

How to define temporary variables with the `with` tag in a template to better control content display logic?

When developing website templates in AnQiCMS, we often need to handle various data and decide the display mode of the content according to these data.With the complexity of website functions, the logic in the templates sometimes becomes difficult to understand and maintain.At this point, mastering some advanced template tag usage is particularly important, and the `with` tag is one of the practical tools that can significantly improve the readability and control of the template.### The `with` tag: A tool for defining temporary variables in templates The `with` tag allows us to define temporary variables within a specific area of the template

2025-11-08

How to use the `stampToDate` tag to format timestamps into a friendly date format to display content publication time?

During the operation of the website, the publication time of the content is an important part of conveying information to visitors.A clear and readable date format not only enhances user experience but also makes the website look more professional and timely.In AnQiCMS, the content publish time is usually stored in the form of a series of numbers (i.e., a timestamp).How can we convert these numbers into the familiar 'year-month-day' or 'month/day time:minute' formats that we are accustomed to?AnQiCMS provides us with a very convenient template tag: `stampToDate`.

2025-11-08

How to handle images (download remote, Webp, compress large images) to optimize page display speed in content settings?

As website operators, we all know that website loading speed is important for user experience and search engine rankings.Especially on content-rich websites, images are often a key factor affecting page speed.AnQiCMS (AnQiCMS) provides us with several very practical image processing features in the content settings, allowing us to flexibly optimize images and significantly improve the display speed of the website. ### Localizing remote images, controlling image resources During the process of content creation, we sometimes refer to images from other websites. At this time

2025-11-08

How does the navigation settings support creating navigation at different locations to meet the diverse content display needs of the website?

In website operation, the navigation system plays a crucial role, it is not only the map for users to explore the content of the website, but also the key for search engines to understand the structure of the website.A well-designed navigation can significantly improve user experience, guide users to discover more interesting content, thereby extending visit time, and indirectly help the website's SEO performance.AnQiCMS provides a user-friendly and powerful navigation settings feature, allowing you to flexibly build various types of navigation to meet the diverse content display needs of the website.### Core Concept: Flexible Construction of Navigation AnQiCMS

2025-11-08

How to set custom parameters in the background and flexibly call them in the front-end template to display specific information?

In a content management system, flexibility is the key to improving operational efficiency and meeting personalized needs.AnQiCMS deeply understands this, providing powerful custom parameter functions, allowing users to flexibly expand content attributes according to business characteristics, and accurately display this information in front-end templates.This article will discuss in detail how to set custom parameters in the Anqi CMS backend, as well as how to call them in the front-end templates to create a more expressive and functional website.--- ### The Power of Custom Parameters

2025-11-08

How to configure independent SEO information and template display for a single page (such as "About Us") in the page management?

In website operation, each page has its unique value and goal.For pages such as "About Us", "Contact Us", and "Terms of Service", they often carry brand stories, core values, or important contact information, which are crucial for building corporate image and user trust.Therefore, configuring exclusive SEO information and personalized display templates for these specific pages is an effective way to enhance the professionalism and user experience of the website.AnQiCMS deeply understands these needs, providing flexible and powerful functions, allowing you to independently configure SEO information and specify personalized template display for each single page

2025-11-08