Optimize SEO, enhance user experience: AnQiCMS Custom Article Detail Page URL Rewrite Rule Explanation

In website operation, a clear and meaningful URL structure is crucial for search engine optimization (SEO) and user experience. Imagine, when a user sees/article.php?id=123&category=newsSuch a link, and seeing/news/anqicms-url-guide.htmlWhich link would be more attractive to them to click on?It is clearly the latter.This is the charm of pseudo-static rules.AnQiCMS as a fully functional content management system, fully considers this point, and provides us with powerful pseudo-static configuration capabilities, especially for the URL of the article detail page, which can be highly customized according to our needs.

Why is it so important to customize URL pseudo-static rules?

Pseudo-static rules, simply put, is to convert those dynamic, parameterized web page addresses (such asarticle.php?id=123),Rewritten through technical means to look more concise and more like a static page URL (like)/article/123.html)。The benefits of this are obvious:

  1. Improve SEO performance:Search engines prefer concise, static URLs that include keywords. They can help search engines better understand the page content, thereby possibly achieving better rankings.
  2. Enhance user experience:Users can get a general idea of the page content through the URL, making it easier to remember and share, and also enhancing the professionalism of the website.
  3. Avoid duplicate content:Dynamic URLs may generate multiple links pointing to the same content in some cases. SEO-friendly URLs help unify the entry and avoid being misjudged as duplicate content by search engines.

AnQiCMS emphasized SEO-friendliness from the very beginning, and built-in features for pseudo-static and 301 redirect management, allowing us to easily achieve these optimizations.

Understand the pseudo-static rule configuration entry of AnQiCMS

To customize the URL rewrite rules for the article detail page, we need to enter the AnQiCMS admin interface. In the admin navigation, find“Function Management”, and then click.Pseudo-static rulesThis is where we perform URL customization magic.

The system provides four preset static rules by default, such as 'numeric mode', 'model naming mode', etc., which are convenient and quick to meet the needs of general websites. However, if we want to control the URL structure more finely, we need to choose“custom pattern”.

In-depth Customization: Create a Unique Article Detail Page URL

Under the "Custom Mode", you can see multiple rule groups, each corresponding to different types of pages, such as article detail pages, category list pages, single pages, etc. What we need to focus on isarchiveThis rule is specifically used to define the URL structure of the article detail page.

Each custom rule follows the format "rule name===rule value". For article detail pages, the rule name is fixed asarchiveThe rule value part is what we use to define the URL structure. Here, AnQiCMS provides some very useful variables that can be flexibly combined:

  • {id}:This represents the unique numeric ID of the article. It is the most basic identifier.
  • {filename}:Corresponds to the 'Custom URL' field you fill in when editing the article.This field allows you to set a unique, descriptive English or pinyin alias for each article, which is the core of SEO-friendly URLs.
  • {module}:Represents the URL alias of the content model the article belongs to. This alias can be set in "Content Management" -> "Content Model".
  • {catname}:Represents the URL alias of the article category. This alias can be set for each category under 'Content Management' -> 'Document Categories'.
  • {catid}:Represents the unique numeric ID of the article category.
  • {page}:Used for pagination, usually on the article list page, and is generally not involved in the article detail page, but understanding its existence is beneficial and harmless.

These variables can be combined with ordinary text and backslashes to create various URL structures./and hyphens-symbols to create various URL structures.

Let's look at several common examples of article detail page URL customization rules:

  1. Simple ID pattern:archive===/{id}.html

    • Example URL:/123.html
    • Description: The simplest URL, using the article ID as the unique identifier.
  2. Module+Custom Filename Pattern:archive==/{module}/{filename}.html

    • Example URL:/article/anqicms-pseudo-static-guide.html
    • Description: Highly recommended pattern.{module}It can bearticleorproductetc.,{filename}This is the custom alias you carefully set for the article. This pattern not only reflects the content type but also includes keywords in the URL, which is very friendly to SEO and user understanding.
      • Hint:.Don't forget to set the "URL Alias" for your model in "Content Management" -> "Content Model", and fill in the "Custom URL" in the editing interface of each article.
  3. Category + Custom Filename Pattern:archive==/{catname}/{filename}.html

    • Example URL:/news/anqicms-latest-update.html
    • Description: Organize URLs by category alias for clearer hierarchy.
      • Hint:.Ensure that a 'custom URL' has been set for each category under 'Content Management' -> 'Document Categories'.
  4. Module + Category + Custom filename pattern:archive==/{module}/{catname}/{filename}.html

    • Example URL:/article/web-design/anqicms-template-dev.html
    • 【en】Explanation: A more detailed hierarchical structure, suitable for websites with complex content categorization.
  5. 【en】Category+ID Pattern:archive==/{catname}/{id}.html

    • Example URL:/tutorials/123.html
    • 【en】Explanation: Combines the semantics of categorization with the simplicity of IDs.

Choose which rules to use mainly depends on the structure of your website content and SEO strategy. Generally speaking, URLs that include keywords with moderate hierarchy are a more ideal choice.

Implementation and Testing: Ensure Everything is Perfect

After configuring custom rewrite rules, the following steps need to be taken to ensure they take effect normally:

  1. Save the configuration and update the cache:Click the Save button on the pseudo-static rule setting page, and then be sure to click the bottom of the left menu in the backgroundUpdate Cache. This is a critical step for applying new settings in AnQiCMS
  2. Check the front-end URL:Open the browser, visit several article detail pages, and check if the URL is displayed according to the new rules. If a 404 error occurs, please carefully check if there is an error in your rule syntax.
  3. Configure 301 Redirect (for old website):If your website has been online and indexed by search engines for a while, it is strongly recommended to use the built-in '301 Redirect Management' feature of AnQiCMS.Redirect the old URL to the new URL, which can effectively prevent SEO weight loss and user access interruption caused by URL changes.

Common Questions (FAQ)

Q1: Will the old URL automatically redirect to the new URL after modifying the pseudo-static rules?A1: AnQiCMS does not automatically generate 301 redirects for all old URLs.If you modify the URL rule of a page that has already been indexed, to avoid SEO loss, you need to manually add 301 redirect rules under 'Feature Management' -> '301 Redirect Management' to direct the old URL to the new URL.

Q2: Why did I set{filename}, but the article detail page's URL still shows ID?A2: Please check the following:

1.  你是否在“伪静态规则”中选择了“自定义模式”,并且 `archive` 规则中确实包含了 `{filename}` 变量?
2.  你是否在文章编辑页面的“自定义URL”字段中填写了内容?如果留空,系统将无法生成 `filename`。
3.  保存规则后是否点击了“更新缓存”?

Q3:{module}/{catname}and{filename}What are the differences between these variables?A3: They are all used to provide semantic information in the URL, but with different origins and scopes:

*   **`{module}`: