|
|
home > usability
> navigation
> create a custom error page
how to create a custom error page
why create a custom error page?
- 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
- It retains your web site branding
- Shows visitors they are still on the same web site
- 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
- If a visitor gets none of the above - will probably
leave your site
- See the example on this web
site for ideas
how to create the custom error pages
- 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
- 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)
- Add/edit the following line: ErrorDocument 404 /errors/error404.html
- 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
- Add any other errors for the pages you have created
- Save .htaccess
- Publish the .htaccess file to your root
site directory (in the same place as your home page)
- Publish your custom error pages
- 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
|