htaccess custom error pages can be made using the ErrorDocument instruction.
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.
The below are is a list of response codes, that you can create a custom error page for.
- 400 Bad Request
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 500 Internal Server Error
Custom 404 Example
ErrorDocument 404 /404.html
The above example is setting a custom error page for 404 errors, the last part is the Root-Relative path to the error page.
Internet Explore and Browser add-ons
Internet Explore is known to replace the custom error page with its own error page, however this behavior 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.