When operating a website, we often pay attention to the quality of the content, the performance of the website, but there is a detail that is often overlooked, yet it is crucial, that is, the structure of the URL (Uniform Resource Locator).A clear and meaningful URL can not only enhance user experience, but is also an indispensable part of search engine optimization (SEO).Our company, Anqi CMS, is well-versed in this, providing flexible and powerful URL rewriting functions that allow us to customize URLs that are both aesthetically pleasing and SEO-friendly according to our needs.
Today, let's delve into the pseudo-static rules of Anqi CMS and the variables enclosed in curly braces, such as{id}/{filename}/{catname}/{module}Wait, how do they cleverly affect the display structure of our website URL.
SEO Static: Making dynamic content have the elegance of a static URL.
First, let's briefly review what pseudo-static is.Our website content is usually dynamically generated, such as displaying articles, product information read from the database.yourdomain.com/article.php?id=123&category=newsThis does not look beautiful, nor is it conducive to search engines understanding the page content. Static rewriting technology is to rewrite such dynamic URLs through server rules, so that they appear to users and search engines as similar to static HTML files, such as becomingyourdomain.com/article/123.htmlHowever, the page content is still dynamically obtained.
The pseudo-static management function of Anqi CMS is very powerful, it is built-in with several commonly used modes for us to choose from, such as numeric mode, model naming mode, etc.Even better, it also provides custom patterns, allowing us to freely combine various variables according to specific needs, creating unique URL structures.These variables are like the 'building blocks' of a URL, the combination of which determines the final URL form.
Unveiling the 'building blocks' of URL construction: Core variable explanation
In AnQi CMS, we mainly encounter the following key variables in the custom pseudo-static rules:
{id}: The unique numeric identity of the content
{id}
For example, if our pseudo-static rule is set toarchive===/{module}/{id}.htmlThen an article with an ID of123The article's URL may be displayed asyourdomain.com/article/123.html.The benefit of this pattern is that the URL structure is very clear, easy for internal system management and identification.But the drawback is that users and search engines can only see a series of numbers, which does not give a direct understanding of the specific content of the page.
{filename}: Is a 'alias' for URL semantic injection
{filename}Variables play a role in making URLs more readable and SEO-friendly. They are usually custom link names for content, and Anq CMS automatically generates pinyin forms based on article titles, single page names, or tag names.filenameOf course, we can also manually modify this during content editingfilenameTo include more keywords to make it more SEO-friendly. It is important to note that this should be done across the entire site.filenameMust be unique, the system will automatically check and may add random numbers to ensure uniqueness.
For example, if we publish an article titled "AnQi CMS New Feature Release", the system may automatically generate afilenamesuch asanqicms-new-feature-release. If the pseudo-static rule is set toarchive===/{module}/{filename}.htmlSo the URL may becomeyourdomain.com/article/anqicms-new-feature-release.html. Such a URL allows users to see the general content at a glance, and search engines can better capture and understand the theme of the page, thus possibly bringing better rankings.
{catname}: Show the hierarchy of the "category name"
{catname}A variable is a custom link name for categories, which is usually automatically generated in pinyin from the category name, and also supports manual modification.This variable is very suitable for constructing URLs with a sense of hierarchy, clearly showing the category of the content.
For example, there is a category named "Company News", itscatnameIt could becompany-news. If we set the pseudo-static rule toarchive===/{catname}/{filename}.htmlSo, an article under the "Company News" category, the URL may display asyourdomain.com/company-news/anqicms-new-feature-release.htmlThis structure not only helps users understand the navigation path of the website, but also passes the information of the content organization structure to search engines.
{module}: Clarifies the "model alias" of the content type.
{module}The variable refers to the URL alias of the content model, which is defined in the content model settings and supports only lowercase English letters.In Anqi CMS, we can create different content models, such as articles (article), products (product), activities (activity), and so on.{module}Variables are used to distinguish between different types of content.
For example, if our article model alias isarticle, and the product model alias isproduct, then usingarchive===/{module}/{id}.htmlrules, an article with ID123The article and ID is for456The product, their URLs will be displayed asyourdomain.com/article/123.htmlandyourdomain.com/product/456.htmlThis makes the website structure more standardized, allowing users to clearly identify the type of content displayed on the current page.
Other auxiliary variables:{catid}and{page}
In addition to the aforementioned core variables, Anqicms also provides{catid}(Category ID) and{page}(pagination page number) and other auxiliary variables.{catid}with{id}Similar, but a numeric ID specifically used for categories.{page}It is very useful when pagination is needed on the list page, usually placed in parentheses to indicate optional, for example(/{page}).
Flexible combination: Customize your exclusive URL structure
The AnQi CMS custom pseudo-static rules adopt the format of "rule name===rule value". The rule name (such asarchiverepresents the document detail page,categoryrepresents the document list page,pagerepresents a single page,tagIt indicates that the label detail page, etc., is fixed, while the rule values can be freely combined with the variables mentioned earlier.
For example, a typical custom rule combination might be:
Document Details Page:
archive===/{module}/{catname}/{filename}.html- Example URL:
yourdomain.com/article/company-news/anqicms-new-feature.html - Parsing:
articleIs a model alias,company-newsIs a category alias,anqicms-new-featureIs the file name of the article. This structure includes the content type, shows the hierarchical relationship, and integrates keywords, which is highly recommended for SEO-friendly URLs.
- Example URL:
Document List Page:
category===/{module}/{catname}(-{page})- Example URL:
yourdomain.com/article/company-news/(First page) oryourdomain.com/article/company-news-2.html(Page 2) - Parsing:The list page is composed of model alias and category alias, and supports optional pagination.
- Example URL:
Through such a flexible combination, we can create highly customizable and