In website operation, a clear and friendly URL structure is crucial for search engine optimization (SEO) and user experience.AnQiCMS provides flexible pseudo-static (URL rewrite) functionality, allowing users to customize the URL format of article detail pages according to their needs.This article will introduce how to customize the URL static rules of the article detail page in AnQiCMS.
Why do you need to customize the URL static rules?
Static URLs (or pseudo-static URLs) have many advantages over dynamic URLs (containing question marks, parameters, etc.)They are usually shorter, more readable, and can make the page content clear to users.For search engines, static URLs are also easier to crawl and index, and keywords appearing in the URL can help improve rankings.AnQiCMS is well-versed in this, therefore it has made pseudo-static management one of its core features to help users optimize their website's SEO performance.
AnQiCMS overview of pseudo-static rules
In the AnQiCMS background, you can find the 'Function Management' menu under the 'Static Rule' option.After entering, the system will display the current website's URL rule settings.AnQiCMS has built-in several commonly used pseudo-static rules such as numeric patterns, model naming patterns, and category naming patterns, etc., which can be directly selected to meet the basic needs of different types of websites.
However, for users who pursue personalization or have specific SEO strategies, built-in rules may not be completely satisfactory.At this time, choosing 'Custom Mode' becomes the key.The custom mode allows us to define the URL structure separately for different types of pages, including article detail pages, article list pages, model home pages, single pages, tag list pages, and tag detail pages.
Custom URL pseudo-static rules for article detail pages
The URL rule for article detail pages is namedarchiveRule name to control. In custom mode, you will see something similararchive===/{module}/{id}.htmlSuch default rules.This indicates that the URL of the article detail page will be composed of the model alias and article ID.But AnQiCMS provides a rich set of variables, allowing you to build URLs that meet your expectations.
Can be used on the article detail pagearchiveCommon variables of the rule include:
{id}The unique ID of the article, usually a number. This is the most common component, ensuring the uniqueness of the URL.{filename}The custom link name of the article.This is a very powerful variable because it allows you to manually set the article URL alias during article editing.anqicms-rewrite-settingsSuch that this readable alias will appear in the URL. It should be noted that when the "Custom URL" field of the article is empty, the system will automatically generate pinyin according to the title of the article as the default{filename}But for SEO and standardization, it is recommended to manually set it and ensure its uniqueness throughout the site.{catname}The custom link name of the category to which the article belongs. If you want the category information to be included in the URL, you can introduce this variable.{catid}The ID of the category to which the article belongs.{module}: The URL alias of the content model to which the article belongs. This helps to distinguish articles under different content models, for example/news/represents the news model,/product/represents the product model.
rule combination example
Here are some common rules and explanations for article detail page URLs:
/article/{id}.htmlThis is the simplest numeric ID pattern. For example:http://yourdomain.com/article/123.html./{module}/{filename}.htmlThis rule combines the alias of the model to which the article belongs with the custom link name of the article. For example, if the model alias isnews, the custom link name of the article isanqicms-update, then the URL may be:http://yourdomain.com/news/anqicms-update.htmlThis pattern is very friendly to SEO because the URL contains readable keywords./{module}/{catname}/{filename}.htmlThis rule adds a category custom link name between the model alias and the article custom link name, forming a URL with more levels. For example:http://yourdomain.com/news/industry-insights/anqicms-update.html. This helps users and search engines understand the attribution of the article./{module}/{catid}-{filename}.htmlIf you want to reflect the category ID in the URL instead of the category name (the category name may be too long or not suitable for direct display in the URL), you can use this pattern. For example:http://yourdomain.com/news/15-anqicms-update.html.
When configuring rules, please pay attentionRule valueFormat: It consists of规则名===规则值For examplearchive===/path/to/your/article.html.
Configuration steps
Set the URL rewrite rule for the article detail page in the AnQiCMS backend, the operation process is as follows:
- Log in to the backendUse the administrator account to log in to the AnQiCMS backend management system.
- Enter the pseudo-static rule management: Find "Function Management" in the left navigation bar, expand it and select "Static Rules".
- Select custom modeOn the page of static rule, find "Custom Mode" and click to select.
- Edit
archiveRuleOn the custom rule list, find witharchive===The starting rule item. Modify the content after the equal sign according to the URL structure you choose. Please refer to the above rule combination example and fill in carefully. For example, if you want to use/{module}/{filename}.htmlFormat it and change this itemarchive==={module}/{filename}.html. - Save configuration: After the modification is completed, be sure to click the 'Save' button at the bottom of the page to make the new rule effective.
- Clear cache and testAfter saving, it is recommended to clear the website cache (usually there is an 'Update Cache' button at the top or side of the background), then visit the article detail page on the website front end, check if the new URL structure has taken effect, and ensure that the page can be accessed normally.
If you have used in the rules{filename}Variable, so when publishing or editing articles, please be sure to fill in a concise, keyword-containing, and unique English alias in the "Custom URL" field in the article editing interface. This will directly affect the URL in{filename}The ultimate content.
Points to note
- Testing is the key.Any modification to the URL rules may affect website access and SEO.After each modification, be sure to thoroughly test the detail page URLs under different articles and categories to ensure they are normal and the content is displayed correctly.
- 301 Redirect
- Uniqueness.: Use.
{filename}It is crucial to ensure the uniqueness of the item across the entire site. If there is a duplicate, the system will automatically add a numerical suffix to distinguish it, but this may not meet your aesthetic or SEO requirements. - SEO-friendlyWhen customizing URLs, try to make them short, include core keywords, and have clear levels, avoiding long parameters and unnecessary special symbols.
By reasonably customizing the URL static rules of the article detail page, AnQiCMS can help your website make a new step forward in content management and SEO optimization, providing users with a better browsing experience and a more friendly indexing environment for search engines.
Frequently Asked Questions (FAQ)
Q1: I modified the pseudo-static rules and saved, but the URL of the article detail page is still the same, why is that?A1: This may be caused by various reasons.First, make sure you clicked the "Save" button.Secondly, after modifying the pseudo-static rules, it is usually necessary to clear the website cache to make the new rules take effect on the front end. Please try to perform the "update cache" operation in the background.Additionally, if your website is deployed on a web server using Nginx or Apache and has configured reverse proxy, you may also need to check if the server configuration is compatible with AnQiCMS's pseudo-static rules, or if you need to restart the web service.
Q2: Use{filename}When is a variable, what is the role of the 'Custom URL' field in the article editing page? How should I fill it out?A2: The 'Custom URL' field is for