As an experienced security CMS website operator, I am well aware of the importance of mobile experience for user retention and search engine optimization.In AnQiCMS, the flexible template mechanism allows us to decide whether and how to configure the mobile end address according to different operational strategies and technical requirements.

When is it necessary to configure the mobile end address of AnQiCMS?

AnQiCMS provides three main website modes to handle mobile end access, they are:Adaptive mode/Code Adaptation ModeandPC + mobile phone independent site mode. Whether you need to configure a separate mobile end address depends on the website model you choose.

InAdaptive modeBelow, the website will use a set of templates and adjust the layout and style automatically according to the screen size and resolution of the device being accessed using technologies such as CSS media queries (Media Queries). In this mode, the PC and mobile ends share the same URL and content, thereforeNot requiredConfigure a separate mobile address. The AnQiCMS system will automatically identify the device and render the corresponding style.

When you chooseCode Adaptation ModeAt that time, AnQiCMS allows you to design two independent templates for PC and mobile terminals.The system will identify the accessing device by detecting the user agent (User-Agent) and automatically switch to the corresponding template file.For example, when accessing from a mobile device it will loadmobile/Templates under the directory. Although in this mode, the PC and mobile ends usually use the same domain name, but if you want to strictly separate management or for some specific SEO considerations, you can consider configuring a separate address for the mobile end.However, the AnQiCMS system itself can seamlessly switch templates under code adaptation mode on the same domain without requiring a separate mobile address.

And forPC + mobile phone independent site modeThis is the most explicit scenario where you need to configure the mobile end address. In this mode, you will set a primary domain name for the PC website (for examplewww.example.com), set up a separate subdomain for a mobile website (for examplem.example.com)。In this mode, the PC and mobile ends will have completely independent content management, template design, and URL structure, thereforeit mustConfigure the mobile end address explicitly in the background to ensure that mobile devices can be correctly directed to the exclusive mobile site.The design of AnQi CMS allows each site to independently manage its content and display in this mode, achieving refined operation.

In short, if you adoptPC + mobile phone independent site modeorCode Adaptation ModeIf there is a specific independent domain name requirement, you need to configure the mobile end address of AnQiCMS.

How to ensure that the AnQiCMS mobile end address can be accessed normally

Ensure that the normal access to the AnQiCMS mobile endpoint is a multi-step process, involving template preparation, domain resolution, backend configuration, and server environment settings.

first, The template preparation is fundamental. If you choose the code adaptation or PC + mobile independent site mode, you need to ensure that your template design includes a dedicated mobile template.In AnQiCMS template conventions, mobile templates should be stored in the main template directory.mobile/In the subdirectory. Thismobile/The structure within the directory should be consistent with the main site template directory structure so that the system can find and correctly load the corresponding mobile page template. For example, if the PC home page isindex/index.htmlThen the file corresponding to the mobile home page should bemobile/index/index.html.

secondly,Domain resolution is a key step. To configure a separate address for the mobile version of the website means you need a dedicated domain name or subdomain, for examplem.example.com. This domain must be DNS resolved at your domain name provider and pointed to the IP address of your AnQiCMS server.The correct DNS resolution is the premise for users to access your mobile website.

Then,AnQiCMS backend configuration is indispensableLog in to your AnQiCMS admin interface, navigate to the "Global Function Settings" under "Admin Settings".Here, you will find an input box named 'Mobile End Address'.Please enter the complete URL prepared for your mobile website, for examplehttps://m.example.com. This setting will inform the AnQiCMS system that when a mobile device access is detected, the user should be redirected to this address or generate a link to this address in the template (for example, through {% system with name="MobileUrl" %}Label). Make sure the URL you fill in is accessible and correct, otherwise it will cause the mobile website to fail to access.

Finally,The configuration of the server environment is crucial.. Your web server (such as Nginx or Apache) needs to configure the corresponding reverse proxy rules to correctly handle requests to mobile addresses.This means you need to configure a new domain for the mobile endserverBlock (for Nginx) orVirtualHost(for Apache). In this configuration, you need to send all tom.example.comThe request is forwarded to the internal port (default 8001) of the AnQiCMS application via a reverse proxy. This usually involves setting theserver_namecommand to your mobile domain andproxy_passThe instructions point tohttp://127.0.0.1:8001. For example, the Nginx configuration may look like this:

server
{
    listen       80;
    server_name  m.example.com; # 您的移动端域名
    root         /www/wwwroot/your-anqicms-dir/public; # AnQiCMS的public目录

    location @AnqiCMS_mobile {
        proxy_pass http://127.0.0.1:8001; # AnQiCMS监听的端口
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
    error_page 404 =200  @AnqiCMS_mobile;
    location / {
       try_files $uri $uri/index.html @AnqiCMS_mobile;
    }
    access_log access.log;
}

After completing the server configuration, be sure to restart your web server to make the changes take effect.Only when all these links are correctly configured, can the mobile end address of AnQiCMS be accessed normally by users and provide the expected mobile experience.


Frequently Asked Questions (FAQ)

1. What are the core differences between AnQiCMS's adaptive, code adaptation, and PC+mobile independent site mode?

The adaptive mode uses a single template and the same URL to automatically adapt to different screens. The code adaptation mode switches to different templates under the same domain name based on the device type (such asmobile/The template under the directory), the URL remains unchanged. The independent site mode for PC and mobile ends assigns completely independent domains and templates to PC and mobile ends, achieving complete separation, and requires an independent mobile end address.

2. Do I have to set a separate domain for the mobile version of the website?

It depends on the website model you choose. If you are usingAdaptive modeThen you do not need a separate mobile domain. If you chooseCode Adaptation ModeThe system can automatically switch templates under the same domain name, usually without the need for a separate mobile domain. But if you choosePC + mobile phone independent site modeIt is necessary to set up a separate mobile domain, for examplem.example.com.

3. I have configured the mobile end address of AnQiCMS, but the website cannot be loaded or an error is displayed when accessed, how should I troubleshoot?

First, check yourDomain resolutionIs it correct, make sure the mobile domain is pointing to the IP of the AnQiCMS server. Next, confirm the AnQiCMS background "Global Function Settings" of the "Mobile end addressFill in the information accurately and completely (including the protocol). Then, check your web server (Nginx/Apache)Reverse proxy configurationto ensure that the mobile domain is set correctly.server_nameandproxy_passThe rule has been restarted and the web server. Finally, check yourmobile/template directoryDoes it exist, and the internal template file structure corresponds to the PC template to ensure that AnQiCMS can find and render the mobile page.