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. However, you may dislike the way the default 404 Not Found page looks. To improve user experience, you can associate full URLs with error codes that are carried 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: default page and custom page. Status code 404 is used as an example to describe the differences between the default page and custom page.
  • Default page: When the HTTP response carries a 404 error code, the server returns the default 404 Not Found page.
  • Custom page: When the HTTP response carries a 404 error code, the server returns the custom page. You must specify a full URL for the custom page.
Note
  • Default pages are considered Alibaba Cloud public resources and are free of charge.
  • Custom pages are considered personal resources and are charged.
  • 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 Dynamic Route for CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the target domain name and click Configure.
  4. In the left-side navigation pane of the specified domain, click Caching.
  5. Click Custom Pages.
  6. On the Custom Page tab, click Add.
    Custom Page
  7. In the Custom Page dialog box, set the parameters.
    For example, you want to store the error404.html page for the 404 error together with other static files on the origin and return this error page to requests addressed to the accelerated domain 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.
  8. Click OK.

    After the custom page is created, you can click Modify or Delete in the Actions column to modify or delete the custom page.