Setting Up Custom Error Documents With Plesk on Windows

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:

  1. Login to Plesk
  2. Click on the Websites & Domains tab.
  3. Click on Hosting Settings next to the domain you are configuring.
  4. Check the box for Custom error documents.
  5. Click OK.
  6. 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 three 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:

  1. Click on the Website & Domains tab (if not already on that page).
  2. Click on File Manager.
  3. Within the Root directory, click the error_docs folder (the text link or the folder in front of the link).
  4. Click on the error page you want to edit. For example, Not_Found.html.
  5. Use Plesk's built-in HTML editor to edit the error page:

  6. 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

  1. Click on the Website & Domains tab (if not already on that page).
  2. Click on Show Advanced Options (grey link near the middle of the page) if the advanced options are not already shown.
  3. Click on Virtual Directories.
  4. Click on the Error Documents tab.
  5. Click on the Error Document you wish to change.
  6. 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
    • Click OK.

Option 3: Using web.config

In addition to configuring custom error pages in Plesk, the web.config file (a file which stores configuration information for websites in IIS) can be edited to configure custom error pages:

  1. Click on the Files tab and open httpdocs (or the document root for the domain you are configuring).
  2. Click on the web.config file to open it in the Plesk text editor.
    If no web.config file exists, create a new file named web.config and place the following text inside:

    <?xml version="1.0"?>
    <configuration>
         <system.web>
            <customErrors mode="On"/>
        </system.web>
        <system.webServer>
            <httpErrors errorMode="Custom">
            </httpErrors>
        </system.webServer>
    </configuration>

  3. Custom error documents can be added in the httpErrors section. The first step would be to add code that removes the preset error document.
    For example, to remove the preset 404 document, add the following code:
    <remove statusCode=”404” subStatusCode=”-1”/>
    Replace the number for the statusCode with the error code you wish to replace.
  4. After the preset error documents have been removed, the new error page can be added.
    404 error page example code:

    <error statusCode=”404”  path=”/path/to/error-file” responseMode=”ExecuteURL”/>

    For the path, use the relative path to the error file from your document root. For example: "/error_docs/NothingHere.html"
  5. The step above can be repeated for each error status code you would like a custom error page for.

Following all of the steps above with a blank web.config file would result in the following example web.config file:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <customErrors mode="On"/>
  </system.web>
  <system.webServer>
    <httpErrors errorMode="Custom">
      <remove statusCode=”404” subStatusCode=”-1”/>
      <error statusCode=”404”path=”/error_docs/NothingHere.html” responseMode=”ExecuteURL”/>
    </httpErrors>
  </system.webServer>
</configuration>