Select Category
Sitemap Help Contact
print article

Linux Custom Error Pages

For Linux packages.

Follow the steps below to create your own custom error pages that will replace the default (404, 403, 500) error pages.

To use your own custom error page, you must:

  • Create the custom error page.
  • Save the custom error page.
  • Upload the custom error page to your web space.
  • Specify the path to the custom error page in the .htaccess file.

Some common errors are listed in the table below:

Error Number Error Description
400 Bad Syntax
403 Forbidden
404 Not Found
500 Internal Error

Reference the example below for the format to use. Each new line must start with "ErrorDocument" followed by a space and then the error number. Leave another space after the error number and then specify the URL for the error page to use. Please note that this .htaccess method does not work for PHP files.

ErrorDocument 400 http://www.your_domain.com/errorDocs/400.html
ErrorDocument 403 http://www.your_domain.com/errorDocs/403.html
ErrorDocument 404 http://www.your_domain.com/errorDocs/404.html
ErrorDocument 500 http://www.your_domain.com/errorDocs/500.html

Save the .htaccess file in the root of your webspace. If you already have a .htaccess file in the root of your webspace, do not overwrite the file but edit the existing one instead. If you are creating/editing the file on a Windows machine, use a basic text editor like Wordpad or Notepad. Save the file as htaccess.txt first and then upload the file to the root of your webspace. Once uploaded, you can then rename the file to .htaccess.

For additional information, you may want to reference: