Printed from www.bareflame.net/kb/index.php at 06:09 on 27/Jun/2017.

BareFlame.net Knowledge Base

Customizing Web Server Error Messages

When visitors coming to your site request pages that the web server cannot find, the web server generates and displays a standard HTML page with an error message. The standard error messages may inform of problems, but they do not usually say how to resolve them or how to get the lost visitor on his way, and they also look dull.

You may want to create your own error pages and use them on your web server. With Plesk you can customize the following error messages:

  • 400 Bad File Request. Usually means the syntax used in the URL is incorrect (for example, uppercase letter should be lowercase letter; wrong punctuation marks).
  • 401 Unauthorized. Server is looking for some encryption key from the client and is not getting it. Also, wrong password may have been entered.
  • 403 Forbidden/Access denied. Similar to 401; a special permission is needed to access the site - a password and/or username if it is a registration issue.
  • 404 Not Found. Server cannot find the requested file. File has either been moved or deleted, or the wrong URL or document name was entered. This is the most common error.
  • 405 Method Not Allowed. The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
  • 406 Not Acceptable. The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.
  • 407 Proxy Authentication Required. This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy.
  • 412 Precondition Failed. The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.
  • 414 Request-URI Too Long. The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI.
  • 415 Unsupported Media Type. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.
  • 500 Internal Server Error. Could not retrieve the HTML document because of server-configuration problems.
  • 501 Not Implemented. The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.
  • 502 Bad Gateway. The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.

 

To configure Plesk's web server to show your custom error pages:

  1. Switch on support for custom error documents through Plesk. On your Home page, click the domain name you need, and then click Setup. Select the Custom Error Documents check box. Click OK.
  2. Connect to your FTP account on the Plesk server, and go to the error_docs directory.
  3. Edit or replace the respective files. Be sure to preserve the correct file 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
  4. Wait for a few hours till your Web server is restarted. After that, the Web server will start using your error documents.

Tags: Customizing Web Server Error Messages

Tell us what you think!!

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

Useful tools....

Digg it! Print this record Send to a friend Show this as PDF file

BareFlame.net Support Team Solution ID #1036

Last update: 2008-02-06 19:28 | Revision: 1.0