Custom Error Pages In htaccess

Posted The: 22/08/2008 At: 5:27

It is also possible to create your own 404 pages, but basically you could redirect users on any http response code.

Custom Error pages is useful when you don't want to lose traffic, from deleted or moved pages. Directing your users to either an internal 404 error page, or to the new location of the requested page, will usually hold on to them.

Overview

  1. 400 Bad Request
  2. 401 Unauthorized
  3. 403 Forbidden
  4. 404 Not Found
  5. 500 Internal Server Error

Example

ErrorDocument 404 /404.html

The above example is first defining the ErrorDocument, then the type of error, in this case for the 404 Not Found Error. Next it defines the location of the error page, in this case using a Root-Relative Path, you can use either Root-Relative or Absolute Paths.

Internet Explore and Browser add-ons

Internet Explore is known to replace the custom error page with its own error page, however this behaviour only seam to occur when the page is below 512 bytes.

Some browser add-ons are also known to act in similar ways, so it would be a good idea to insure that the page is bigger then the 512 bytes.

Comments: [0]

© Brugbart Webdesign