header left image   header right image

Home > Toolkit > Custom Error Page

Creating Custom Error Pages

As a web publisher, you can create your own error documents, such as a custom 404 pages, on Brown's server. There are three different ways to do this, the text display, the URL redirect, and the local redirect.

Whichever of these three methods you choose, you will have to first create an .htaccess file (or edit an .htaccess file you already have). An .htaccess file is simply a plain text file that you create, name .htaccess and put in the uppermost directory you wish to effect. That directory, and every directory below it, will use the custom errors you define.

**Note: To see your custom error page in IE, you may need to change a setting. To make this change in IE, click Tools > Internet Options > Advanced and under the Browsing heading, uncheck "Show Friendly HTTP Error Messages". Click OK to exit.

In all three cases, the syntax you use in your .htaccess file will look like this

ErrorDocument three-digit-code action

Text display
The first way to customize your error page is to simply change the text that appears on the standard web page. Choose the error page you wish to change (a list is available at the end of this document), and find its three-digit code. Then add a line to your .htaccess file which says

ErrorDocument 404 "Sorry, but the page you're looking for is not here."

The text, which you must place within quotation marks, will appear on the page when a user gets a 404 page not found error when looking for something in one of your directories.

URL redirect
A URL redirect will cause the user to be forwarded to a URL you specify when they get a particular error. For example, you can add a line such as this to your .htaccess file

ErrorDocument 404 http://www.mydomain.edu/looking4something/404.html

and instead of displaying a standard text message when a user tries to reach a page that doesn't exist, the server will redirect the user to the URL you specified in the line above. Note that the URL is not in quotation marks (only the text for the text display needs to be in quotation marks.

Local redirect
A local redirect works just like a URL redirect, except instead of putting a URL in the .htaccess file, you'll put a path to a file on your server, like this:

ErrorDocument 404 /looking4something/404.html

Some commonly used error codes
400 Bad Request
401 Authorization Required
403 Forbidden
404 Not Found
408 Request Timed Out
500 Internal Server Error

 

[Toolkit]   [ Publishing Help]   [Publisher Forum]   [Web Policies]  [Web Security]   [Brown Home]   [CIS Home]   [Home]


Page Last Modified: Tuesday, 23-Mar-2004 15:46:55 EST by CIS