In AnQiCMS, applying different URL parsing strategies for different content types such as articles, products, and pages is a key step to optimizing website structure, improving search engine optimization (SEO) and enhancing user experience.AnQiCMS has powerful static rule management and flexible content model design, making this requirement easy to achieve.
The foundation of content model and URL structure
One of AnQiCMS's core advantages lies in its 'flexible content model'.The system divides the website content into different models, such as the default "article model" and "product model", as well as other models that you can customize according to your business needs.In addition, the single-page content also has its independent management mechanism. It is this model-based classification management that lays a solid foundation for our customized URL parsing strategy.The system can clearly distinguish what you are operating, whether it is an article, a product detail page, or a service page, and thus apply the corresponding URL rules.
AnQiCMS URL parsing strategy overview
AnQiCMS has built several pseudo-static rules to meet the needs of different scenarios.You can find the 'Static Rules' setting item under the 'Function Management' menu in the background.System Provided:
- Numeric mode:The main use of content ID numbers in URLs, concise but lacks semantics.
- Model naming pattern:The URL includes the model name, which helps identify the content type.
- Categorization naming pattern 1/2:The URL includes the category name, strengthening the hierarchical relationship of the content.
These preset modes are convenient, but if you want to have more refined and SEO-friendly control over the URL structure, then 'Custom Mode' will be your first choice.The custom pattern gives you the ability to tailor the URL structure for different content types.
Deep customization: Custom URL parsing rules.
You need to enable the 'custom mode' of AnQiCMS to implement different URL parsing strategies for different content types.This allows you to define separate URL structures for core content types (articles/products, categories, single pages, etc.)
In Custom Mode, AnQiCMS provides a series of available variables to help you build logical and semantic URLs:
{id}: Unique ID of the content.{filename}The custom URL alias of the content, usually the pinyin or manually set English keywords.{catname}Custom URL alias for a category.{module}The URL alias of the model the content belongs to (e.g.,)articleRepresents the article model,productRepresents product model).{page}: Page number (used when the URL contains pagination information).
By using these variables, you can freely combine and design URL paths that meet SEO requirements and are easy for users to understand.
Configuration example and explanation:
In the configuration interface of the custom mode, you will see several groups of rules, of which the main ones are directly related to articles, products, and pagesarchive/categoryandpage:
Targeting articles and products (
archiveRules):By default, articles and products belong to the category of "documents" and are sharedarchiverules.- Semantic URL example:
archive===/{module}/{filename}.html{module}Will automatically be replaced with the model alias of the content (such asarticleorproduct){filename}Will be replaced by the unique alias set in the "Custom URL" field in the background of the article or product.- Effect:
/article/anqicms-tutorial.htmlor/product/latest-smartphone-model.htmlSuch URLs can indicate the content type and contain keywords, which are very friendly to search engines and users.
- Semantic URL example:
For category pages (
categoryRules):The URL of a category page usually reflects its hierarchical relationship.- Semantic URL example:
category===/{module}/list-{catname}.html{module}Replace with model alias.{catname}Replace with the alias set in the "Custom URL" field in the backend for this category.- Effect:
/article/list-web-operations.htmlor/product/list-electronics.htmlYou can add pagination if needed.(-{page})such ascategory===/{module}/list-{catname}(-{page}).html.
- Semantic URL example:
For single-page pages (
pageRules):Single pages such as "About Us",- Semantic URL example:
page===/{filename}.html{filename}Replace it with the alias set in the "Custom URL" field of the single page in the backend.- Effect:
/about-us.htmlor/contact.html
- Semantic URL example:
Practical Application: Optimizing URLs for Different Content Types
In the AnQiCMS backend, setting a 'Custom URL' for each content type is the key to implementing the above strategy:
Articles and Products:When publishing or editing an article/product, find the "Custom URL" field. The system will automatically generate a pinyin alias as the default value, but it is strongly recommended that you manually modify it to be more descriptive and include core keywords (for example, for the article "AnQiCMS tutorial", you can set it to
anqicms-tutorialEnsure that this alias is unique throughout the site.Category:When adding or editing a category, there will also be a "custom URL" field. Here you can set a concise and representative English alias for your category (for example, for the "website operation" category, you can set it as
web-operations)Single page:When creating or editing a single page in the page management, set its "custom URL" field. For example, set the "About Us" page to
about-usand get/about-us.htmlsuch a friendly URL.
Operation steps and precautions
To apply these strategies, please follow these steps:
- Log in to the AnQiCMS backend, go to "Function Management" -> "URL Rewrite Rules".
- Select "Custom Mode".
- Edit the URL structure according to your needs (such as
archive/category/page). Make sure the variables you use are correct and the path structure is clear. - Save your changes.
- Important reminder:After modifying the pseudo-static rules, be sure to test your website in different browsers or incognito mode to ensure that all links can be accessed normally without any 404 errors.
- 301 Redirect:If your website has been online for a while and you are modifying the old URL structure, it is strongly recommended that you use AnQiCMS's '301 Redirect Management' feature to permanently redirect the old URL to the new one.This can effectively avoid the decrease in search engine rankings and the interruption of user access due to URL changes.
By using AnQiCMS's flexible URL parsing strategy, you can build logical, semantic-rich, and search engine-friendly URLs for various content on your website, thereby enhancing the overall performance of the site.