How to create custom error pages?

Created:

2016-11-16 12:47:26 UTC

Modified:

2017-08-16 17:35:26 UTC

4

Was this article helpful?


Have more questions?

Submit a request

How to create custom error pages?

Applicable to:

  • Plesk for Windows
  • Plesk for Linux

Question

How to create custom error pages?

Answer

In general, all actions could be performed from Plesk interface:

  1. Select the required subscription at Subscriptions > example.com .
  2. Switch on custom error documents support:

    • Click the Hosting Settings button in the domain toolbar.
    • Select the Custom error documents checkbox.
    • Click OK .
  3. Edit the necessary error pages:

    • Click the File Manager button in the domain toolbar.
    • Click the error_docs folder to open it.
    • Click on the necessary file and select Edit in HTML editor . List of the correct file names is provided below.

    • List of the correct error pages names:

      400 Bad File Request - bad_request.html
      401 Unauthorized - unauthorized.html
      403 Forbidden/Access denied - forbidden.html
      404 Not Found - not_found.html
      405 Method Not Allowed - method_not_allowed.html
      406 Not Acceptable - not_acceptable.html
      407 Proxy Authentication Required - proxy_authentication_required.html
      412 Precondition Failed - precondition_failed.html
      414 Request-URI Too Long - request-uri_too_long.html
      415 Unsupported Media Type - unsupported_media_type.html
      500 Internal Server Error - internal_server_error.html
      501 Not Implemented - not_implemented.html
      502 Bad Gateway - bad_gateway.html
      503 Service Temporarily Unavailable - maintenance.html

    The web server will start using your error documents in a few hours after it is restarted.

Also, after enabling Custom error documents at Hosting Settings error pages could be edited by other OS-specific ways:

  • On Linux : by connecting via FTP:

    • Connect to the server via FTP, and go to the error_docs directory.
    • Change or replace the respective files.
  • On Windows:

    • Click Virtual Directories to see the list of error documents for the root web directory. Error documents located here are used for all web pages of the selected site. If it is needed customize error pages for a specific virtual directory, navigate to that directory.
    • Click Error Documents tab and click the required error document in the list.
    • To use the default document provided by IIS for this error page, select Default in the Type menu.
    • To use custom HTML document already located in the error_docs directory in the virtual host directory of the domain, select File in the Type menu and specify the file name in the Location field.
    • To use custom HTML document located in a directory other than error_docs on a domain, select URL in the Type menu and enter the path to your document in the Location field. The path should be relative to the virtual host root (that is, <vhosts>\<domain>\httpdocs ).

      For example, the forbidden_403_1.html file has been created and saved in the "%plesk_vhosts%"\example.com\httpdocs\my_errors directory. To use this file as an error document, select the URL item in the Subscriptions > example.com > Websites & Domains > example.com > Virtual Directories > Error Documents > 403 > Type drop-down list and set the following path into the Location field:

      http://example.com/my_errors/forbidden_403_1.html
      

      Alternatively, the forbidden_403_1.html file has been created and saved in the "%plesk_vhosts%"\example.com\error_docs\my_errors directory. To use this file as an error document, select the File item in the Type drop-down list and set the following path into the Location field:

      my_errors\forbidden_403_1.html
      

      Note: connection over FTP or File Manager in Plesk can be used to upload custom error documents to the server. By default, all error documents are stored in the "%plesk_vhosts%"\example.com\error_docs directory.

      Note: Make sure that the option Custom error pages is chosen in IIS > Sites > example.com > Error Pages > Edit Feature Settings...

For more details check Plesk Administrator's Guide

Have more questions? Submit a request
Please sign in to leave a comment.