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. The default error page of a web server may not meet your requirement. 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 provides the default page and the custom page for HTTP error codes. The 404 error code is taken as an example to describe the differences between the default page and the 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 Custom pages are considered as personal resources and fees are charged based on the specified billing rules.

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. Click the Custom Pages tab.
  6. On the Custom Pages tab, click Add.
  7. 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 accelerated domain name exp.aliyun.com. Then, you only need 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.
    Custom page
  8. Click OK.
    On the Custom Pages page, you can click Modify or Delete to manage the custom page.