Overview
Custom error pages allow you to show a customised page for all web server errors, but most commonly, 404 Not Found and 500 Internal Errors. This allows you to show a more user friendly or branded page when a page is not found or in the event of 500 Internal Errors, capture or notify the webmaster so that the errors can be corrected.
This article will show you how to enable custom error pages in Plesk under Unix. There is a different method for Windows hosted accounts. See How To Enable Custom Error Pages In Plesk - Windows
Methods For Enabling Custom Error Pages
There are two methods for using custom error pages for Unix hosted accounts.
If you only wish to modify the default HTML error pages follow the first method using Plesk. If you wish to redirect common error pages to a PHP page you will need to use the second method which uses a .htaccess file.
Enabling Custom Error Pages in Plesk - Unix
- Turn on support for custom errors documents in Plesk
- Once logged into Plesk, click on your domain name and then click the Setup icon.
- Select the Custom Error Documents check box.
- Click OK
- Login via FTP and edit the custom HTML error pages within the /error_docs directory
You can use both FTP and File Manager to upload your custom error document to the server. By default, all error documents are stored in the /error_docs/ directory.
Enabling Custom Error Pages With a .htaccess File
Create a .htaccess file with a text editor and for each error you want to redirect, add the following directive to the .htaccess file:
ErrorDocument 000 /path/to/file
where 000 is the error number e.g. 400, 404, 500) and /path/to/file is the location of your new error document. For example, if you have created an error page at http://www.example.com/errors/404.php then set the path as /errors/404.php
Example:
ErrorDocument 404 /errors/404.php
Do this for each custom error document, example:
ErrorDocument 400 /errors/bad-request.php
ErrorDocument 401 /errors/unauthorised.php
ErrorDocument 403 /errors/forbidden.php
Save and upload the .htaccess file to the document root of your site or to any folders where you need to change the default document that is loaded when the folder is accessed.