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.
- 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.
- 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?.
- Log on to the DCDN 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 Configure in the Actions column.
- In the left-side navigation pane on the details page of the specified domain, click Caching.
- On the Custom Pages tab, click Add.
- In the Custom Pages dialog box, specify the Error Code and Link parameters.For example, you want to store the
error404.htmlpage 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.comaccelerated 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.htmlin the Link field.
- Click OK.
On the Custom Pages page, you can click Modify or Delete to manage the custom page.