Web Hosting - Custom Error Documents
Custom error pages (404 File Not Found, 403 Forbidden, etc.) can be tailored for specific HTTP status codes for your Windows/IIS or LAMP site.
When visitors to your site request pages that the web server cannot find, the server generates and displays a standard HTML page with an error message. The standard error messages alert visitors to the problem, but do not usually include how to resolve it. They also tend to look dull.
Windows/IIS Accounts
DoIT Web Hosting can configure a custom error document for you. Just prepare a custom doc within your httpdocs directory and send an email to webhosting@doit.wisc.edu specifying the document location and the error number(s) for which it should be configured.
If you want to configure a custom error page yourself, you can do so by following these instructions:
- Connect to the server either with your SecureFTP login or the Plesk Control Panel's File Manager.
- Go to the error_docs directory one level above your httpdocs location.
- Edit or replace the respective files. Be sure to preserve the correct file names:
- 401 - Access denied.
401.1 - Logon failed.
401.2 - Logon failed due to server configuration.
401.3 - Unauthorized due to ACL on resource.
401.4 - Authorization failed by filter.
401.5 - Authorization failed by ISAPI/CGI application. - 403.1 - Execute access forbidden.
403.2 - Read access forbidden.
403.3 - Write access forbidden.
403.4 - SSL required.
403.5 - SSL 128 required.
403.6 - IP address rejected.
403.7 - Client certificate required.
403.8 - Site access denied.
403.9 - Forbidden: Too many clients are trying to connect to the Web server.
403.10 - Forbidden: Web server is configured to deny Execute access.
403.11 - Forbidden: Password has been changed.
403.12 - Mapper denied access.
403.13 - Client certificate revoked.
403.14 - Directory listing denied.
403.15 - Forbidden: Client access licenses have exceeded limits on the Web server.
403.16 - Client certificate is untrusted or invalid.
403.17 - Client certificate has expired or is not yet valid.
403.18 - Cannot execute requested URL in the current application pool.
403.19 - Cannot execute CGI applications for the client in this application pool. - 404 - Not found.
404.1 - Site Not Found.
404.2 - ISAPI or CGI restriction.
404.3 - MIME type restriction.
404.4 - No handler configured.
404.5 - Denied by request filtering configuration.
404.6 - Verb denied.
404.7 - File extension denied.
404.8 - Hidden namespace.
404.9 - File attribute hidden.
404.10 - Request header too long.
404.11 - Request contains double escape sequence.
404.12 - Request contains high-bit characters.
404.13 - Content length too large.
404.14 - Request URL too long.
404.15 - Query string too long. - 405 - Method Not Allowed.
- 406 - Client browser does not accept the MIME type of the requested page.
- 412 - Precondition failed.
- 500 - Internal server error.
500.13 - Web server is too busy.
500.14 - Invalid application configuration on the server.
500.15 - Direct requests for Global.asax are not allowed.
500.16 - UNC authorization credentials are incorrect.
500.17 - URL authorization store cannot be found.
500.18 - URL authorization store cannot be opened.
500.19 - Configuration data is invalid.
500.100 - Internal ASP error. - 501 - Header values specify a configuration that is not implemented.
- 502 - Web server received an invalid response while acting as a gateway or proxy.
- 401 - Access denied.
LAMP Accounts
If you want to configure a custom error page yourself, you can do so by using the Plesk Control Panel or by using an .htaccess file to specify error locations.
Using Plesk
- Connect to the server either with your SecureFTP login or the Plesk Control Panel's File Manager. (under Websites & Domains).
- Go to the error_docs directory one level above your httpdocs location.
- 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
Using .htaccess Files
- Create a file within your site named .htaccess. Below are examples of the text used to redirect:
- ErrorDocument 403 /errordocs/error403.htm
- ErrorDocument 404 /errordocs/error404.htm
- ErrorDocument 500 /errordocs/error500.htm
- Create the custom error pages within your website. Using the examples above, any error code resulting in 404 would be forwarded to yoursite.wisc.edu/errordocs/error404.htm.
Plesk Error Pages
Here are some error codes for which you might want custom error pages and what they mean:
- 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, etc.).
- 401 Unauthorized: The server is looking for some encryption key from the client and is not getting it. Also, the 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: The server cannot find the requested file. It 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 unnacceptable characteristics 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 meta-information (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.