Loading...

Knowledge Base

Setup Custom Error Docs on Plesk Linux VPS

To use custom error pages on your Plesk Linux VPS, add a few lines of code to the .htaccess file in your httpdocs directory, then create the error pages themselves. When a visitor runs into an error such as 404 Not Found, they see the page you created instead of the server's default error page.

Add the Error Documents to Your .htaccess File

Please add this code to your .htaccess file in the httpdocs directory.

ErrorDocument 403 /403.shtml
  ErrorDocument 404 /404.shtml
  ErrorDocument 500 /500.shtml

Next, create a file named 403.shtml in your httpdocs folder. Now the 403 errors will yield the 403.shtml page. Repeat for 404.shtml and 500.shtml.

Use an Existing Page as the Error Page

You can use the existing pages as the resulting page. Say you do not want any visitors seeing the 404 errors on your site. You can make your homepage show the result, like so:

ErrorDocument 404 /index.html

If your browser shows its own error page instead of yours, make sure your custom error page is larger than 512 bytes. Some browsers replace very small error pages with their own.

Error Codes You Can Define

There are many error pages that may be defined.

Client Request Errors

Code Error
400 Bad Request
401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable (encoding)
407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content-Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request URI Too Long
415 Unsupported Media Type

Server Errors

Code Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

Loading...