How to display or customize the error pages (such as 404, 500) and shutdown notifications of a website?

Calendar 👁️ 117

In the operation of the website, visitors may encounter lost pages or temporary problems with the server due to various reasons, and even may not be able to access the website when it is under maintenance or upgrading.Faced with these situations, a well-designed error page (such as 404, 500) and a friendly shutdown prompt can not only greatly improve the user experience but also to some extent maintain the professional image of the website and search engine optimization (SEO).AnQi CMS as an efficient content management system, provides a flexible way to display and customize these important pages.

Understanding the importance of error pages and shutdown prompts

Imagine, when a user eagerly visits your website and is suddenly greeted with a cold browser default error page, it undoubtedly confuses and frustrates them, and they may leave right away.A customized error page, like someone guiding you when lost, can effectively soothe the user's emotions and guide them back to other content on the website.

  • 404 page (page not found)This usually happens when a user clicks on a broken link, enters an incorrect URL, or your website content is deleted or moved without setting up a 301 redirect.A well-designed 404 page can guide users back to the homepage, try a search, even recommend related content, thereby reducing the bounce rate.
  • 500 page (internal server error)This type of error indicates that the server encountered an unexpected problem, usually requiring the intervention of a website administrator.Although the user is helpless in this regard, a friendly 500 page can inform the user that the issue is being addressed, avoid making them think that the website is completely down, and provide contact information.
  • Shut down promptWhen your website needs maintenance, upgrade, or migration, temporarily shutting down the website is a common operation.At this time, a clear shutdown notice can timely inform visitors of the situation, explain the expected recovery time, and provide other information (such as social media accounts), and maintain communication with users.

Next, let's see how to customize these key pages in Anqi CMS.

Custom website error page: 404 and 500

The template mechanism of AnQi CMS is very flexible, allowing you to easily create personalized displays for 404 and 500 error pages.

First, you need to find the current template folder. Typically, all template files are stored in/template/the directory, and the template you are using will have its corresponding independent subdirectory, such as/template/default/In your template directory, you will find a subdirectory namederrors/. If this directory does not exist, you can create it manually.

in thiserrors/In the directory, you need to create two files to customize the 404 and 500 pages:

  • 404.htmlIt is used to handle all 'page not found' requests.
  • 500.html:Used to handle all "server internal error" requests.

In these HTML files, you can design content as you would for a regular page.You can add the website's logo, navigation menu, search box, and even recommend some popular articles.It is important to provide clear guidance, such as a 'Return to Home' button, or display a search bar to help users find the content they need.The AnQi CMS provides rich template tags that allow you to easily call dynamic information on the website, such as using{% system with name="SiteLogo" %}to display the website logo, or use{% navList navs %}Show the main navigation. This ensures that the error page is consistent with the overall style of your website.

For example, a concise and practical404.htmlThe page may include the following elements:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>404 - 页面未找到 - {% system with name="SiteName" %}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入网站的通用CSS样式 -->
    <link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
</head>
<body>
    <header>
        <!-- 引入网站顶部导航或其他公共部分 -->
        {% include "partial/header.html" %}
    </header>

    <main class="error-page">
        <div class="container">
            <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" class="error-logo">
            <h1>很抱歉,您访问的页面不存在</h1>
            <p>我们似乎找不到您正在寻找的页面,它可能已被移动、删除或您输入了错误的地址。</p>
            <p>您可以尝试:</p>
            <ul>
                <li><a href="{% system with name="BaseUrl" %}">返回网站首页</a></li>
                <li>使用下方的搜索框查找内容:</li>
            </ul>
            <form action="/search" method="get" class="search-form">
                <input type="text" name="q" placeholder="请输入关键词进行搜索...">
                <button type="submit">搜索</button>
            </form>
            <p class="contact-info">如果您认为这是一个错误,请联系我们:{% contact with name="Email" %}</p>
        </div>
    </main>

    <footer>
        <!-- 引入网站底部信息 -->
        {% include "partial/footer.html" %}
    </footer>
</body>
</html>

For500.htmlDue to its nature being more inclined towards server-side issues, you can provide a shorter prompt to inform the user that the website is striving to recover and suggest trying again later.

Configure and display the site closure prompt

When the website needs to be temporarily closed for maintenance, Anqicms also provides you with a convenient site closure setting and custom prompt function.

You need to go to the website backend to enable the shutdown feature and set the prompt. Find and click on it in the menu on the left.“Background Settings”and then selectGlobal function settings.

Here, you will see a name called“Website Status”The option. When you change it from "normal operation" to "shutdown", your website will immediately display the shutdown prompt. Immediately afterwards, you can"Shutdown Prompt"Enter specific information you want to display to visitors, for example, "The website is undergoing maintenance and is expected to be restored after XX hours. We apologize for the inconvenience caused!"}

Of course, AnQi CMS not only allows you to enter simple text prompts in the background, but also supports displaying more brand-characteristic shutdown pages through custom templates. In your template directory.errors/In the folder, create a namedclose.html.

in thisclose.htmlIn the template, you can freely design the layout and style of the shutdown page. And the shutdown prompt content filled in the background "Global Function Settings" can be accessed through{% system with name="SiteCloseTips" %}This template tag is introduced toclose.htmlthe page. In this way, you can quickly update the shutdown information through the background, and ensure that it presents elegantly in the custom design.

Oneclose.htmlAn example might look like this:

`html &lt;!DOCTYPE html&gt;

<meta charset="UTF-8">
<title>网站维护中 - {% system with name="SiteName" %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
<style>
    .maintenance-page {
        text-align: center;
        padding: 100px 20px;
        background-color: #f8f8f8;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .maintenance-page h1 {
        color: #333;
        font-size: 2.5em;
        margin-bottom: 20px;
    }
    .maintenance-page p {
        color: #666;
        font-size: 1.1em;
        line-height: 1.6;
        max-width: 600px;
        margin-bottom: 15px;
    }
    .maintenance-logo {
        max-width: 150px;
        margin-bottom: 30px;
    }
</style>

<div class="maintenance-page">
    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" class="

Related articles

How to display the list of dynamic Banner images configured in the website?

The website's banner area, like a dynamic promotional window, its visual appeal and content delivery efficiency directly affect the first impression of visitors to the website.A well-designed Banner that can quickly capture the user's attention and effectively showcase the brand image, latest activities, or core products.In AnQiCMS (AnQi CMS), by utilizing its powerful content management features, you can easily configure and display a dynamic banner image list, keeping your website fresh and attractive.###

2025-11-09

How to add hreflang tags in templates to support multi-language SEO?

With the increasing trend of globalization, many websites are facing the challenge of providing content to users of different languages or regions.To ensure that your multilingual website performs well in search engines and accurately guides users to their preferred language version, adding the `hreflang` tag is crucial.AnQiCMS (AnQiCMS) is an enterprise-level content management system that deeply supports multilingualism and provides a convenient way to implement this feature in templates.### Understand the role of the hreflang tag `hreflang`

2025-11-09

How to display multi-language switch options for the current site?

How to easily add multilingual switching options to a website in AnQi CMS?With the continuous deepening of globalization trends, many enterprises and content operators find that having a website that supports multilingual is crucial for expanding the market and serving users in different regions.AnQi CMS understands this need, therefore it has built-in powerful multilingual support functions, allowing you to easily manage and display content in different languages. After your website content is prepared in multiple languages, the next step naturally is to provide visitors with an intuitive language switcher.This can not only improve the user experience

2025-11-09

How to design a basic template and allow other pages to inherit it?

Building websites in AnQi CMS, efficient and flexible template design is the key to improving development efficiency and maintaining website consistency.Among them, designing a basic template and allowing other pages to inherit it is the core strategy to achieve this goal.AnQi CMS adopts a syntax similar to the Django template engine, making template inheritance intuitive and powerful. ### Lay the Foundation: Create Your Basic Template First, let's create the basic template skeleton of a website. In Anqi CMS, all template files are stored in the `/template` directory

2025-11-09

How to use AnQiCMS to customize the display layout of the article detail page?

AnQiCMS provides a very flexible and powerful content management system, allowing us to easily customize the display layout of article detail pages.In order to enhance user experience, optimize SEO, or better showcase the brand characteristics, AnQiCMS can help us achieve these goals through its intuitive template system and rich tag features.How can we proceed specifically? We can delve into these aspects step by step.### 1. Understanding AnQiCMS template mechanism First

2025-11-09

Does AnQiCMS support displaying different detail page styles based on different content models?

In website operation, we often encounter such needs: different types of content, even on the same website, also need to have completely different display styles.For example, a product detail page of an e-commerce website needs to highlight product images, prices, inventory information, etc., while the blog article detail page may focus more on the reading experience, author information, and publication date.This ability to customize the style of detail pages based on content type (also known as content model) is crucial for improving user experience and content professionalism.Then, while using AnQiCMS

2025-11-09

How to display only articles of specific categories in the article list?

When managing website content in Anqi CMS, we often need to flexibly control the display of article lists, for example, only displaying articles under specific categories on a certain page.This not only helps to organize the content of the website accurately, but also greatly improves the browsing experience of visitors, helping them find the information they are interested in faster.AnQi CMS provides powerful template tag features, making this requirement simple and intuitive.The core of achieving this goal lies in the `archiveList` template tag of Anqi CMS.This tag is used to obtain the 'universal key' for the article list from the database

2025-11-09

How to configure AnQiCMS to enable lazy loading of images on the page?

In today's rich network world, the speed of website loading is of great importance to user experience and search engine optimization (SEO).Especially when a page contains a large number of images, how to effectively manage the loading of these images, avoid the lag caused by loading all resources at once, has become a focus of many website operators.The Lazy Load (Lazy Load) technology is the tool to solve this problem, it allows images to be loaded only when the user is about to see them, thus significantly improving page performance.AnQiCMS as a high-performance content management system

2025-11-09