DirectAdmin Tutorial: Setting Up Custom Error Pages


Error Page: An Error Page is a web page that gets displayed when the requested resource (web page) becomes unavailable due to various reasons such as server error, client-server connectivity issues, access restrictions set up by the site admin or error in typing the destination URL. Different types of error pages are denoted by different error codes. For example, error pages displayed due to access restrictions are associated with “401 Unauthorized” error code; while issues on the server side would invoke a ”500 Internal Error”.

custom-error-page-directadmin

Custom Error Page: Custom Error Pages are the modified versions of the default error pages set up by the respective website administrator. Custom error pages can be used to effectively convey meaningful information to your visitors in case of any planned/unplanned outage of your website content, rather than just showing a text message with “Error Code – Text” (Ex – 404 – File Not Found).

This tutorial will guide you on the procedure of setting up and modifying custom error pages in DirectAdmin hosting control panel.

STEP-1: Login to your DirectAdmin console. Scroll down to “Advanced Features” section (next to E-mail Management section) on the home page and click on the “Custom Error Pages” link.

STEP-2: This interface lists all the default error pages. Each error code will have a corresponding template file that can be edited via DirectAdmin administrative panel. Select a template file to make modification. In this example, we will be creating custom error page for error type “404 – Not Found”. For your information, a 404 error page appears when a visitor attempts to visit a non-existent page on your website. Click on the corresponding template file (404.shtml in our case) to make custom changes.

STEP-3: Input the html code of the page content that you want to display as your custom 404 error page. Please note that the code pasted here must be html/css compliant having <head>, <body> and <html> tags inserted at the required places. Images can be included here with proper <img> tag. Before saving the changes, you can preview the customized page by clicking on “Preview Html” button below the code editor.

STEP-4: If you are happy with the outcome of the preview, go ahead and click on “Save As” button. A new item (404.shtml) will get added to your website home directory right below ”cgi-bin folder”.

NOTE 1: Do not change the file name (404.shtml in our case) while saving the modified code if you wish to replace the existing default template with the newly created custom one.

NOTE 2: Internet explorer does not show custom error pages that are less than 512 bytes in size. To prevent IE from showing the default error page, you can insert an image file to your error page template.