How to design and apply custom rewrite rules to generate SEO-friendly URLs using `filename` or `catname`?

Calendar 👁️ 73

The structure of website links plays a crucial role in search engine optimization (SEO).A clear, meaningful, and keyword-rich URL not only helps search engines better understand page content, but also improves user experience.AnQiCMS provides powerful static page generation features, allowing us to flexibly design and apply SEO-friendly URL rules,巧妙利用filenameandcatnameVariables are the key to achieving this goal.

Why is the structure of URLs important for SEO?

Before delving deeper into the pseudo-static rules of Anqi CMS, let's first briefly review why it is worth investing effort in optimizing the URL structure.Search engine spiders prioritize the clarity and relevance of URLs when crawling and indexing website content.A URL that includes keywords and a reasonable hierarchy can help search engines quickly identify the theme of the page, thus possibly obtaining a better ranking in search results.At the same time, users can also get a general idea of the page content from the URL before clicking on the link, which undoubtedly will improve the click-through rate and trustworthiness of the website.

The 'Static and 301 Redirect Management' as well as 'Advanced SEO Tools' are listed as core features of Anqi CMS, which reflects its SEO-friendly design philosophy. Through static, we can convert dynamically generated URLs (usually with question marks and a series of parameters) into static page-like URLs, such asyourwebsite.com/news/industry-trends.htmlThis is not only beautiful, but also conforms to the preferences of search engines.

Anqi CMS built-in static rules and custom options

The AnQi CMS provides a series of built-in static rules, such as numeric patterns, model naming patterns, and category naming patterns, which usually meet the needs of general websites.But for users who seek the ultimate SEO effect or have specific URL structure requirements, custom static rules provide endless possibilities.

To set up custom static rules, we need to go to the "Function Management" menu of Anqi CMS backend, find the "Static Rule" option.Here, you will see an area that allows you to customize the URL format.

Understandingfilenameandcatname: The core of building SEO-friendly URLs.

Within the custom static rules,filenameandcatnameThese are two very practical variables that can help us create highly customizable and SEO-friendly URLs.

  • {filename}This variable usually represents the 'custom URL' field filled in the document (article, product, etc.), single page, or tab page.When you are editing an article, a single page, or a tag in the background, there will be a 'Custom URL' input box.The system will automatically generate pinyin based on the title, but you can manually modify it to a more descriptive, keyword-rich English or pinyin phrase.For example, an article named "Anqi CMS User Manual" is aboutfilenamecan be set toanqicms-tutorial.
  • {catname}This variable is used to represent the content filled in the 'Custom URL' field of the category page.Similarly, when creating or editing a category, you can set a unique custom name that includes keywords.For example, a category named "website operation" whosecatnamecan be set towebsite-operation.

By using these variables, we can get rid of relying solely on IDs ({id}A way to identify the page, making the URL itself meaningful.

How to design and apply custom pseudo-static rules?

The custom pseudo-static rules of Anqi CMS are by规则名===规则值It consists of the form, providing independent configuration items for different page types (document details, document list, model homepage, page, tag list, tag details).

Here are some based onfilenameandcatnameVariable design ideas and examples:

  1. Document detail page(archiveRules):

    • the targetThe custom phrase containing category names and article titles in the URL.
    • Example rules:archive===/{catname}/{filename}.html
    • ExplanationIt will generate a similaryourwebsite.com/website-operation/anqicms-tutorial.htmlThe URL. Search engines and users can clearly see the category and theme of the article from the URL.
    • Operation: When editing articles in the background, make sure the category you belong to is set.catname, the article itself is setfilename.
  2. Category list page (categoryRules):

    • the target: The URL includes custom category phrases and supports pagination.
    • Example rules:category===/{catname}(-{page}).html
    • Explanation: This will generateyourwebsite.com/website-operation.htmloryourwebsite.com/website-operation-2.html(Page 2) URL. The category name is directly reflected in the URL, concise and clear.
    • Operation: When editing categories in the background, set its自定义URLto the expectedcatname.
  3. Single page (pageRules):

    • the target: The URL directly reflects the theme of the single page.
    • Example rules:page===/{filename}.html
    • Explanation: For example, the "About Us" page'sfilenameis set toabout-us, will generateyourwebsite.com/about-us.html.
    • Operation: When editing a single page in the background, set its自定义URLto the expectedfilename.
  4. Tag detail page (tagRules):

    • the target: The custom phrase included in the URL.
    • Example rules:tag===/tag/{filename}.html
    • Explanation: For example, the 'SEO optimization' tag'sfilenameis set toseo-optimization, will generateyourwebsite.com/tag/seo-optimization.html.
    • Operation: When editing tags in the background, set their自定义URLto the expectedfilename.

Design principles tips:

  • SimplicityThe shorter the URL, the better, avoid redundant information.
  • readabilityUse easily understandable words or phrases, not random numbers or乱码.
  • Keywords: Naturally integrate the target keywords, but avoid keyword stacking.
  • hyphen: Use hyphens (-) to separate words in URLs instead of underscores (_)
  • lowercase: All letters in a URL should ideally be lowercase to avoid potential content duplication and compatibility issues.

Implementation and precautions

  1. Plan firstBefore changing the pseudo-static rules, it is best to plan the entire website's URL structure first. Once changed, the old URL may become invalid.
  2. Enable custom rulesIn the "Function Management" -> "URL Rewrite Rules" page, select "Custom Mode" and then enter the rules you design.
  3. Fill in the custom URL fieldMake sure to fill in the information carefully when publishing or editing documents, categories, single pages, and tags自定义URLFields. This content will be used directly to generate URLs. Anqi CMS usually generates pinyin automatically based on the title, but it is recommended to optimize it manually to make it more SEO valuable.
  4. Test verification: After changing the pseudo-static rules, it is necessary to comprehensively test all page links on the website, including article details, category lists, single pages, tag pages, and pagination links, to ensure that all links can be accessed normally.
  5. 301 RedirectIf the website has been running for a while and the URL structure has changed, it is strongly recommended to use the 301 redirect function built into Anqi CMS to permanently redirect the old URL to the new URL to retain search engine weight, avoid traffic loss and 404 errors.You can find '301 Redirect Management' in 'Function Management'.

Through careful design and application of includefilenameandcatnameThe pseudo-static rules, your security CMS website will have a more structured, more conducive to search engine crawling and user understanding of the URL, thus laying a solid foundation for the website's SEO performance.

Frequently Asked Questions (FAQ)

1. Why did I set custom static rules but the front page URL did not change?First, please confirm that you have selected the "custom mode" and saved in the background "function management" -> "URL rewrite rules".Secondly, only newly published articles, categories, or single pages can directly apply the new rules.For existing content, if you do not make any changes to the 'Custom URL' field on the content editing page, the system will continue to use the old URL generation logic or the original URL alias.It is recommended to re-edit and update the "custom URL" field for all pages that need to apply the new rules after changing the pseudo-static rules, and check if the system cache has been cleared.

2. UsefilenameorcatnameWhat if multiple articles/categories have the same content filled in the 'Custom URL' field?AnQi CMS requirements自定义URLNo matter whether it isfilenameOrcatnameThe custom URL must be unique across the entire site. If the same custom URL is set for different content in the background, the system usually adds random numbers or characters at the end automatically to ensure its uniqueness.Therefore, it is recommended to ensure the uniqueness of the fields when filling them out, to avoid the system automatically adding suffixes, in order to maintain the simplicity and beauty of the URL.

3. What is the impact of changing the static rules on my website's SEO? What should I pay attention to?Changing the static rules will have a direct and significant impact on the website's SEO.If not handled properly, it may cause the existing search engine to lose its inclusion and ranking to drop.The most critical note is:

*   **规划先行**:在实施前做好充分的URL结构规划。
*   **301重定向**:对于所有发生变化的旧URL,务必设置301永久重定向到新的URL。这是保留原有SEO权重、避免404错误的唯一有效方法。
*   **提交Sitemap**:更新伪静态规则后,重新生成并提交新的Sitemap给各大搜索引擎,引导它们抓取新的URL结构。
*   **测试**:部署新规则后,对所有关键页面和链接进行全面测试,确保没有死链或访问问题。

Related articles

How to configure Baidu and Bing API interfaces for link push function to improve page inclusion efficiency?

In content operation, it is a key link to improve website traffic and visibility by allowing search engines to quickly discover and index our pages.Manually submitting links is inefficient and prone to omission.Fortunately, AnQiCMS provides a convenient link push function that can help us automatically submit new or updated pages to major search engines like Baidu and Bing, thereby significantly improving the page inclusion efficiency.Why link promotion is crucial for SEO

2025-11-07

How does the newly added Markdown editor of AnQiCMS support the correct display of mathematical formulas and flow charts?

## Make Content More Vivid: How AnQiCMS Markdown Editor Elegantly Presents Mathematical Formulas and Flowcharts The recent upgrade of AnQiCMS has brought an integrated Markdown editor, which undoubtedly brings great convenience to content creation.For operators who need to write technical documents, tutorials, reports, or any content that includes complex logic display, it is undoubtedly a blessing to be able to directly insert mathematical formulas and flowcharts into the article and have them displayed correctly.This article will discuss in detail how to implement this feature in AnQiCMS

2025-11-07

How to implement the image classification, batch transfer, and quick replacement operations of the image resource management function?

## Make image management no longer a hassle: Anqi CMS classification, batch transfer, and quick replacement feature details In this visually content-driven era, images on websites are not only auxiliary to content but also key elements that attract users, enhance experience, and even affect search engine rankings.However, as the content of the website becomes richer, the number of images also increases, and if these images are just scattered together, it will be extremely difficult to search and manage, and even slow down the efficiency of content updates.AanQi CMS understands the importance of image management for website operation

2025-11-07

How to create and manage custom content models in AnQiCMS and add specific fields to them?

In daily website operations, we often encounter the need to publish various types of content.In addition to common articles and product displays, you may also need a dedicated "event list" to post the latest events, or a "team members" page to showcase the core team of the company, or even a "successful case" module to share project experience.AnQiCMS was designed with this flexibility in mind, providing powerful custom content model features, allowing us to flexibly create and manage different types of content structures according to our actual business needs. So

2025-11-07

How to add custom parameters to meet the specific information display requirements in the contact information settings?

During the process of building and operating a website, displaying contact information is often a crucial link.It is not only a bridge for visitors to communicate with you, but also a key element for building trust and improving conversion rates.AnQiCMS (AnQiCMS) understands this need, providing basic contact information settings while also giving users great flexibility, allowing you to customize and display various contact information according to your unique business needs.This article will guide you to a deep understanding of how to set up custom contact information parameters in Anqi CMS to meet the specific information display needs of your website template

2025-11-07

How to implement the switch of multilingual sites and the setting of default language package in AnQiCMS?

A deep analysis of AnQiCMS multi-language site switching and default language package settings In today's global internet environment, website support for multiple languages has become a key factor in expanding the market and improving user experience.AnQiCMS as a system dedicated to providing an efficient and customizable content management solution also offers flexible and powerful multilingual support.This article will elaborate on how to implement multi-language site switching in AnQiCMS, as well as the setup of the default language package.

2025-11-07

How to build a complex document parameter filtering interface using the `archiveFilters` tag, such as real estate, product filtering?

In website operation, providing users with an efficient and accurate content filtering function is the key to improving user experience and content discoverability.Whether it is complex real estate information, massive product SKUs, or professional industry documents, a well-designed filtering interface can allow users to quickly locate the information they need.In Anqi CMS, the `archiveFilters` tag is a powerful tool for building such complex filtering interfaces.### Understand the core of the filter interface: content model and custom parameters Build a flexible filtering function

2025-11-07

How to display article comments using the `commentList` tag and integrate reply and like functions?

When building a vibrant website, the article comment feature is undoubtedly a core element to enhance user interaction and promote the development of a content community.AnQiCMS as an efficient and flexible content management system, provides us with powerful template tags, making it simple and intuitive to integrate and display comments.Today, let's delve into how the `commentList` tag in AnQiCMS helps us display article comments and cleverly integrate reply and like functions.

2025-11-07