Loading...

Knowledge Base

How to Set Up Custom Error Pages in Plesk on Windows Server

To properly configure Plesk custom error pages on a Windows server, follow the steps below. These instructions apply to Plesk 18 and similar versions.

Step 1: Turn On the Custom Error Pages

Before configuring error documents, you must enable custom error pages in Plesk.

  1. Click Websites & Domains from the left-hand menu.

    Plesk - Websites & Domains

  2. Locate the domain you wish to configure.
  3. Click on Hosting Settings under the domain you are configuring.

    Plesk - Hosting Settings

  4. Navigate to the Web scripting and statistics section, then check the box for Custom error documents.

    Plesk - Custom Error Documents

  5. Click OK.
  6. You will be taken back to the Websites & Domains page with a successful notification at the top of the page.
    √ Information: The settings were successfully updated.

Once Custom Error Pages are turned on, you can edit, configure, or create new error documents.

Step 2: Configure the Custom Error Pages

You can configure your Plesk custom error pages using two methods: editing existing files or using the web.config file for IIS.

Option 1: Editing an Existing Custom Error Page

The simplest way to create your own Plesk error page is to modify an existing one.

  1. Click on the Website & Domains tab (if not already on that page).

    Plesk - Websites & Domains

  2. Click on the File Manager icon.

    Plesk - File Manager

  3. Within the Root directory, click the error_docs folder.

    Plesk - File Manager - error_docs

  4. Click on the error page you want to edit. For example, not_found.html.
  5. Use Plesk's built-in code editor to edit the error page.

    Plesk - Code Editor

  6. Click OK to save your changes.

Once saved, your changes will take effect. No additional steps are necessary.

Option 2: Using web.config File

You can also manage IIS custom error pages through the web.config file.

  1. Click on the Files tab and open httpdocs (or the document root for the domain you are configuring).

    Plesk - File Manager

  2. Locate the web.config file to open it in the Plesk text editor.
  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.
  4. After the preset error documents have been removed, the new error page can be added.
  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>

Loading...