When a client requests a web service through a browser, the website hosting server returns the default 404 Not Found page if the requested URL does not exist. You may dislike the way that the default error page of a web server looks. To improve user experience, you can associate full URLs with error codes that are included in HTTP or HTTPS responses. When an error occurs, the server returns the associated custom page. This topic describes how to customize an error page.

Background information

Alibaba Cloud Dynamic Route for CDN (DCDN) provides two types of error pages for the status codes: default page and custom page. The 404 status code is used as an example to describe the differences between a default page and a custom page.
  • Default page: When the HTTP response includes the 404 status code, the server returns the default 404 Not Found page.
  • Custom page: When the HTTP response includes the 404 status code, the server returns the custom page. You must specify a full URL for the custom page.
Note
  • Default pages for the 404 status code are considered as Alibaba Cloud public resources and do not incur charges.
  • Custom pages are considered as personal resources and incur charges based on the specified billing rules.
  • For information about the reasons why 404 pages are returned, see Why does the 404 Not Found page appear?.

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 on the details page of the specified domain, click Caching.
  5. On the Custom Pages tab, click Add.
  6. In the Custom Pages dialog box, specify the Error Code and Link parameters.
    For example, you want to store the error404.html page and other static files on the origin server. You also want to return this error page to requests that are destined for the exp.aliyun.com accelerated domain. Then, you need only to select 404 from the Error Code drop-down list and enter the full URL http://exp.aliyun.com/error404.html in the Link field.
    Customize an error page
  7. Click OK.

    On the Custom Pages page, you can click Modify or Delete to manage the custom page.