Jessett.com home  

usability

navigation

custom error pages
image maps

home > usability > navigation > create a custom error page

how to create a custom error page

why create a custom error page?

  1. Visitors get errors for various reasons
    • e.g. Even if there are no broken links in your web site a visitor may misspell a url and get a page not found Error 404
  2. It retains your web site branding
    • Shows visitors they are still on the same web site
  3. Can be a useful navigation tool and help keep visitors on your web site
    • In addition to the branding, include the main navigation links
    • Include a brief message explaining the error
    • Try to be helpful - suggest they check the link
    • Don't use the word "error" - can scare off visitors
    • Include a brief paragraph about your web site
    • Include a search box
    • Include a site map
    • Provide an email link to your webmaster
  4. If a visitor gets none of the above - will probably leave your site
  5. See the example on this web site for ideas

how to create the custom error pages

  1. Create all the custom error pages you need for your site (see list below)
    • For example, create a 404 error page and save in a folder called /errors/ as error404.html
    • Error 404 Page Not Found is the most common
  2. Go to the main root directory of your web site (in the same place as your home page)
    • Look for a file called .htaccess (it starts with the dot as though it is a long file extension)
    • If you have the file, you need to edit it.
    • If you don't have the file, create a new text document and save it as ".htaccess" (you need to include the dot)
  3. Add/edit the following line: ErrorDocument 404 /errors/error404.html
  4. The text needs to remain exactly as above
    • Stay on one line
    • A space on either side of the number 404
    • Case sensitive - the uppercase of the E and D in ErrorDocument
  5. Add any other errors for the pages you have created
  6. Save .htaccess
  7. Publish the .htaccess file to your root site directory (in the same place as your home page)
  8. Publish your custom error pages
  9. Test to see if it works on your web site by typing in an erroneous url

list of errors

Error Code Label
400 Bad Request
401 Authorization Required
403 Access Forbidden
404 File Not Found
500 Internal Server Error

further information

http://www.javascriptkit.com/howto/htaccess.shtml