If an error occurs when a user visits a page, the default error page is displayed, such as 404 Not Found. Alibaba Cloud CDN allows you to customize error pages. If errors occur when users visit your web pages, the custom error pages are displayed. This helps you improve user experiences. This topic describes how to create a custom error page.
Background information
Alibaba Cloud CDN 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-friendlier 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 customize 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 Alibaba Cloud CDN, you are charged based on the billing rules of Alibaba Cloud CDN.
- For more information about 404 Not Found pages, see Why does the 404 Not Found page appear?
Procedure
- Log on to the Alibaba Cloud CDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
- In the left-side navigation pane of the domain name, click Cache.
- Click the Custom Pages tab.
- Click Customize. In the dialog box that appears, select an HTTP status code and enter a URL.
- Click OK. After the custom page is created, it is displayed on the Custom Pages tab. You can Modify or Delete the page.
Configuration examples
Alice wants to customize an error page for the HTTP 404 status code. The URL of the page
error404.html
is under the root directory of the origin server. Users can visit the page through the accelerated domain name example.aliyundoc.com
. In this case, Alice can use the following settings to customize an error page for the HTTP 404 status code: - HTTP status code: 404.
- URL: 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.