Practice of independent content display for multiple sites of AnQi CMS: Ensuring exclusive style for each site

In today's rapidly changing digital world, many businesses and content operators may need to manage multiple websites at the same time, whether to distinguish brands, sub-markets, or meet different business needs.AnQiCMS (AnQiCMS) provides an efficient and convenient solution for such needs with its powerful multi-site management function.However, one of the core challenges of managing multiple sites is to ensure that each site can independently display its exclusive content without interference, presenting a unique 'exclusive style'.

This article will deeply explore how Anqi CMS guarantees that each site's independent content can be correctly identified and displayed from the underlying architecture to the front-end display.

Understanding the independent multi-site mechanism of AnQi CMS

Ensure that each site's content is displayed independently, first you need to understand the design of Anqi CMS at the data level.The system has always considered the needs of multi-site operations, providing independent data storage and management capabilities for each site.

When we add a new site through the AnQi CMS backend, the system will require us to set an independent "site root directory" and "database name" for the new site.This is not an unnecessary step, but the foundation for achieving content independence.dev.anqicms.comnew site, whose data may be stored in a nameddev_anqicms_comindependent database, and its cache, configuration files, etc. will be stored in/app/dev_anqicms.comUnder such a dedicated directory. This means that the content between different sites (including articles, products, pages, categories, tags, and even user data) is strictly isolated at the data storage level, naturally avoiding data confusion.

Second, intelligent recognition of front-end access and security CMS

How does the Anqi CMS know which content to load and display when the user enters the domain name of a different site?This mainly depends on the front-end reverse proxy configuration and the intelligent matching mechanism of Anqi CMS.

Firstly, whether it is an Nginx or Apache web server of this kind, they will act as reverse proxy roles.You will configure reverse proxy rules for each site domain, forwarding all requests for that domain to the same core service port of AnQi CMS (usually port 8001).It is important that when forwarding requests, the web server retains the original domain name information accessed by the user.

The AnQi CMS will compare the domain information carried in the request header with the "website address" of each site configured in the "Multi-site Management" backend after receiving the request.Once matched successfully, the system can quickly identify which specific site the current request belongs to.This way, AnQi CMS can accurately load the corresponding configuration, data, and template of the site, ensuring that the front-end display is exactly the content that the user expects for that site.

Third, fine control of content at the template level

Even if the backend data is properly isolated and identified, the display ability of the front-end template is crucial.Our CMS provides great flexibility at the template level to ensure accurate rendering of content.

  1. Independence of default behavior: When you visit a specific site's page (for example,siteA.comA certain category page or article detail page), the Anqi CMS template engine will automatically load and render the exclusive data of the site. No additional configuration is required, the system will default to processing all content tags based on the current site context, for example,archiveListThe tag automatically retrieves the list of articles from the current site,categoryDetailThe tag automatically displays the category details of the current site.

  2. Flexible template customization:

    • Independent template themeEach site can select and configure its own exclusive template theme in the background.This means that the appearance, layout, and functionality of different sites can be completely different, even if they are managed by the same AnQi CMS instance.
    • Custom template filesFor some special page or content types, you