Views:

Custom error pages are frequently used to provide additional information to visitors and to maintain the look and feel of your website.

Some of the more common customized error pages include the following:

206 Partial content301 Document moved permanently
302 Document found elsewhere400 Bad request
401 Authorization required403 Access forbidden
404 Document not found408 Request timeout
500 Internal server error501 Request type not supported

When you create the custom error page, please consider the following common situations:

  • Main navigation links
  • Brief explanation of error
  • Contact information, for example, email link to the Webmaster
  • Site map or search function for the rest of your website
  • Hyperlink to the page if the page has been moved

Save the custom error pages to your root directory. Once you have created your custom error pages, then the .htaccess file is used to activate these pages.

Perform the following steps to activate the web pages:

  1. 1. Access the main root directory of your website and look for the .htaccess file.
  2. If the file exists you will need to edit it. If the file does not exist, you will need to create one using a basic text editor such as NotePad.
  3. Note: The file name should be only .htaccess. If NotePad adds an additional extension to the name, you will need to remove it.

  4. 2. Add or edit the following line:
    • ErrorDocument 404 /error404.html
  5. 3. After ErrorDocument specify the error code, followed by a space, then the path and filename of the .html customized error file you would like to display when the specified error is generated.
  6. Using these error codes, your .htaccess file appears as the following:
    • ErrorDocument 206 /error206.html
    • ErrorDocument 301 /error301.html
    • ErrorDocument 400 /error400.html
    • ErrorDocument 403 /error403.html
    • ErrorDocument 500 /error500.html
  7. 4. Save the .htaccess file in the domain root directory where the customized error pages are located.
  8. You have set up your custom error pages.

Note: Please review the following limitations and best practices when using .htaccess files:

  • .htaccess files must be uploaded in ASCII mode not binary mode, and the permissions need to be set at 644 (rw-r--r--).
  • .htaccess files affect the directory they are placed in and all subdirectories.