Custom error page: Difference between revisions
No edit summary |
Niteowlneils (talk | contribs) replace example that no longer behaves as described |
||
Line 7: | Line 7: | ||
==Default 404 error messages== |
==Default 404 error messages== |
||
*[http://httpd.apache.org/404 Apache] |
*[http://httpd.apache.org/404 Apache] |
||
*[ |
*[http://www.webcpa.com/blah Microsoft IIS] |
||
==Custom 404 error message examples== |
==Custom 404 error message examples== |
Revision as of 20:12, 23 June 2006
A custom error page is a feature of most Web server software that allows you to replace default error messages with ones you create. The default error messages tend to be fairly generic, and not particularly user-friendly, so making custom messages for a site is recommended.
Custom error pages are often overlooked when designing a website simply because many people do not understand how important they can be. A standard error page gives the proper information of course, but a nice custom error page can do so much more. When someone encounters a bad link to your site and sees a traditional error page they will probably just leave. If you have good custom error pages which not only look nice, but also give the user links to the sections of your site, they will almost always click through to find what they need. Good web design firms will always create custom error pages when they set up your site (see [1]).
You can make them look more like the rest of a site, and/or provide better recovery navigation. The Not Found (404) error is the one users are most likely to encounter, so it is the most important to customize.
Default 404 error messages
Custom 404 error message examples
Creating custom error pages
The instructions below assume you have direct access to a Web server you set up. If your site is hosted by a third party, they may have already provided one or more default error pages. Check your host's documentation.
Custom error page creation using Apache HTTP Server
If you run a Web server using the Apache HTTP Server software, you can easily specify custom error pages through server configuration files such as httpd.conf or .htaccess. You can specify custom error pages using the ErrorDocument directive. It is used as follows:
# The following line specifies the error page for the '404 Not Found' error ErrorDocument 404 http://yoururl.com/404.htm # The following line specifies the error page for the '403 Forbidden' error ErrorDocument 403 http://yoururl.com/403.htm # The following line specifies the error page for the '401 Unauthorized' error ErrorDocument 401 http://yoururl.com/401.htm
This may be put in an .htaccess file, which can be created using a text editor. Everything defined in an .htaccess file will only take effect for the directory it is located in and its child directories.
Custom error page creation using Microsoft IIS
- Use a text editor or an HTML editor to create your custom page on your server
- From your server's desktop, launch the Internet Services Manager (usually located at Start->Programs->Administrative Tools->Internet Services Manager)
- Click the [+] to the left of the server name
- Right-click on "Default Web Server" (or whatever you may have renamed it as), and click on "Properties"
- Click on the Custom Errors tab
- Click on the number of the HTTP Error you want to make the custom message for, then click "Edit Properties"
- Use the Browse button to locate the custom file you created and click OK. Keep clicking OK to dismiss the windows, then close the IIS window
External links
- ErrorDocument Directive in Apache HTTP Server 2.0 documentation
- Customised 404 Error Pages Improving website usability with customised 404 error pages
- 404 Research Lab Exploring the art of the 404 page