Please add this code to your .htaccess file in the httpdocs directory.
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml
Next create a file named 403.shtml in your httpdocs folder. Now the 403 errors will yield the 403.shtml page. Repeat for 404.shtml and 500.shtml.
You can even use existing pages as the resulting page. Say you don't want any visitors seeing 404 errors on your site. You can make your home page the result, like so:
ErrorDocument 404 /index.html
If Internet Explorer is not displaying the custom error page, it is likely because the error page must be larger than 1 kilobyte.
There are many error pages which may be defined.
Client Request Errors
400 - Bad Request
401 - Authorization Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable (encoding)
407 - Proxy Authentication Required
408 - Request Timed Out
409 - Conflicting Request
410 - Gone
411 - Content Length Required
412 - Precondition Failed
413 - Request Entity Too Long
414 - Request URI Too Long
415 - Unsupported Media Type
Server Errors
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported
In order to setup custom error pages in Plesk on a Windows server, please do the following:
Turning on Custom Error Pages
Before you can use custom error pages, you must first turn them on.
- Login to Plesk
- Click on the Websites & Domains tab.
- On the list of domain name at the bottom, click on the domain name you are configuring.
- Check the box for Customer error documents.
- Click OK.
- You will be taken back to the Websites & Domains tab and it should say "Information: The settings were successfully updated" near the top of the page.
- Once you have Custom Error Pages turned on, you have two options for setting them up: edit the existing error documents, or create new ones.
Option 1: Editing an Existing Custom Error Page
The easiest way to create your own error page is to edit the ones already there.
- Click on the Website & Domains tab (if not already on that page).
- Click on File Manager.
- Click on the error_docs folder (the text link or the folder in front of the link).
- Click on the error page you want to edit. For example, Not_Found.html.
- Use Plesk's built-in HTML editor to edit the error page.
- Click OK to save your changes.
- Once saved, your changes will take effect. No additional steps necessary.
Option 2: Setting up Custom Error Pages
Instead of editing the existing error pages, you can create your own with different filenames, or even specify that it redirects to a specific URL instead.
Step 1: Creating the New Error Page
Create a new page and upload it to your domain. It can be named anything, and can be in any supported language such as HTML, PHP, ASP and ASP.NET.
You can use the File Manager in Plesk to create a new file, and then edit it, or create it on your own computer and then FTP it to the server.
Step 2: Telling the Server to Use the New Error Page
- Click on the Website & Domains tab (if not already on that page).
- Click on Show Advanced Options (grey link near the middle of the page) if the advanced options are not already shown.
- Click on Virtual Directories.
- Click on the Error Documents tab.
- Click on the Error Document you wish to change.
- Set the options for that error:
Type:
Default - Use the Windows IIS Default Error Page.
File - Use a specific file. The file must be located in the error_docs directory.
URL - Use a specific a custom error document located in a directory other than error_docs.
Location: Input the file name or URL, depending which type you selected. If the custom error document is located in a directory other than error_docs, the path should be relative to the virtual host root (i.e.<vhosts>\<domain>\httpdocs).
For example, /my_errors/forbidden_403_1.html.