Default error pages are displayed to your website visitors when an error occurs, such as when a user enters an incorrect URL or is not authorized to access a specific directory in your web site. For the detailed description of HTTP error codes please refer to RFC2616.
This article explains how to create customized error pages to brand them with a specific corporate image and a link to their home page for the following platforms:
- Create a custom HTML file or a custom script file (.asp, .php, .pl or .cfm depending on your account plan and needs)
- Upload the file via FTP and place the file under \htdocs.
- Navigate to HostPilot > Web/FTP Server > Web Server > HTTP Errors and specify the path to this file in Custom Error File Location field across the appropriate error. Leave this field blank to use default error messages.
- Open IIS Remote Manager.
- In Features View, double-click on Error Pages.
- In the Add Custom Error Page dialog box, under Status code, type the number of the HTTP status code for which you want to create a custom error message.
- In the Response Action box do one of the following:
- Select Insert content from static file into the error response and uncheck Try to return the error file in the client language in case you need to set a static error page (a simple .html file or a static .asp script) or
- Select Execute a URL on this site if you need to use a dynamic .aspx file as the error page.
- In the File path text box, type the full path of the custom error page as shown on the picture if you chose Insert content from static file into the error response, or specify the folder name and the name of the error page file in relate to the /htdocs if you use the Execute a URL on this site path type, and then click OK.
- Create an .htaccess file under /htdocs directory if it does not exist yet
- Add the following line to the .htaccess file (example):
ErrorDocument 401 /error401.html
- Upload error401.html file via FTP and place it under /htdocs.
At this point, when your website visitors hit any non-existent URL on your web site, the Apache server displays the error401.html file instead of the default 401 error message.
For more information on creating custom HTTP error messages on Linux platform please refer to the Apache documentation.