HOME    articles    tutorials    tool directory    about

Free Email
META Tag Generator



Custom Error Pages - Page 2

Using a plain text editor such as notepad, open a blank file. Put the following in it:

ErrorDocument 404 /404error.html

and save it as htaccess.txt

This tells your server to display the page /404error.html whenever a requested page is not found. Note that this must all be on one line, and the text is case sensitive. If you type errordocument instead of ErrorDocument, it will not work.

If you named your error page something other than 404error.html, or put it somewhere other than the root directory, modify the above accordingly. For example, if you called your file myerrorpage.html and put it in a subdirectory named errors, your htaccess.txt file would look like this:

ErrorDocument 404 /errors/myerrorpage.html

Step 4: Upload the .htaccess File
Warning: a bad .htaccess file can cause your Web site to stop working completely! Before uploading, check and double check that you have created the file exactly as described above!

Second Warning: It's also a good idea to verify that a .htaccess file doesn't already exist on your Web server. You wouldn't want to overwrite the original. If you didn't put one there for some other reason (for example to provide password protection) then there probably isn't one.

Upload the file you created (htaccess.txt) to the root directory of your Web site. Using your ftp program, rename it to .htaccess

Tip: If your FTP program has an option to "show hidden and system files" or something similar, turn it on and you will be able to see (and thus delete if necessary) .htaccess. Otherwise once you rename it, .htaccess it will be hidden from you.

Step 5: Test
Now it's time to view the fruits of your labor. Open your Web browser and type in the a bogus URL at your Web site, for example:

http://www.mysite.com/nosuchpage.html

Your new not found page should appear.

In the unlikely event you get a 500 internal server error instead of your not found page, don't panic, it just means there is something wrong with the format of the .htaccess file. Getting rid of the file will get your site working again. Follow these emergency instructions for accessing hidden files via ftp.

Common Web Site Error Codes
404 page not found
500 internal server error
400 bad request
403 access forbidden
Now that you've created one custom error page, you can create more, using the same process. Since 404 errors are by far the most common, it's not entirely necessary. You can create separate error pages for other possible errors, or use the same error page for multiple types of errors, simply by adding lines to your .htaccess file.

###

previous page


HOME    articles    tutorials    tool directory    about

(c) copyright 2000-2010 Anventure.  All Rights Reserved.
privacy policy