Custom Error Pages In htaccess
Tutorial showing how to create your own error pages using htaccess. This Tutorial shows how to make your own custom 404 pages.
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.
http response codes
The below are a collection of error response codes, that you can create a custom 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 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 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.