If an error occurs when a user visits a page, the default error page is displayed, such as 404 Not Found. Dynamic Route for CDN (DCDN) allows you to create custom error pages. If errors occur when users visit your web pages, the custom error pages are displayed. This helps you improve user experience. This topic describes how to create a custom error page.

Background information

DCDN can redirect requests to custom error pages when errors occur.

If a client requests a web service by using a browser and the requested URL does not exist, the website server returns the default 404 Not Found page. If you want to use a user-friendly error page, you can create a custom error page and specify the complete URL of the page. Requests are redirected to the specified URL based on the HTTP status code in the responses.
Note
  • You can create custom error pages for the following HTTP status codes: 400, 403, 404, 405, 414, 416, 500, 501, 502, 503, and 504.
  • If the delivery of the custom error page is accelerated by DCDN, you are charged based on the billing rules of DCDN.

Procedure

  1. Log on to the DCDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage, and click Configure in the Actions column.
  4. In the left-side navigation pane of the domain name, click Caching.
  5. Click the Custom Pages tab.
  6. On the Custom Pages tab, click Add. In the dialog box that appears, select an HTTP status code and enter a URL.
    Create a custom error page
  7. Click OK.
    On the Custom Pages page, you can click Modify or Delete to manage the custom page.

Configuration examples

Alice wants to create a custom error page for the HTTP 404 status code. The URL of the custom page error404.html can be found in the root directory of the origin server. Users can visit the page by using the accelerated domain name example.aliyundoc.com. In this case, Alice can use the following settings to create a custom error page for the HTTP 404 status code:
  • Error Code: 404.
  • Link: the URL of the custom error page, for example, http://example.aliyundoc.com/error404.html.
  • Expected result: When a 404 error occurs, requests are redirected to the custom error page http://example.aliyundoc.com/error404.html.