[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] How do I trap 404 errors on a web site
- Subject: RE: [cobalt-users] How do I trap 404 errors on a web site
- From: "JM" <jm@xxxxxxxxx>
- Date: Tue Dec 19 10:50:01 2000
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
>-----Original Message-----
>From: Bruce Becker <web5sr@xxxxxxxxx>
>Subject: [cobalt-users] How do I trap 404 errors on a web site
>
>How can I identify 404 errors and redirect them to the
>home page?
>
>Thanks
>Bruce
*********
* FIRST *
*********
You probably want directory specific error messages setup...
(skip to *SECOND* if you already have this setup)
Open the srm.conf file: /etc/httpd/conf directory (make backup)
Look for what is usually:
===
ErrorDocument 401 /cobalt_error/authorizationRequired.html
ErrorDocument 403 /cobalt_error/forbidden.html
ErrorDocument 404 /cobalt_error/fileNotFound.html
ErrorDocument 500 /cobalt_error/internalServerError.html
===
Change to: (can be anything, like simply "401.htm")
===
#Changed so that users can automatically set their own error files without
#using an .htaccess file. Original lines are commented below for debugging
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
#Leave 500 as-is so that people can better debug scripts
ErrorDocument 500 /cobalt_error/internalServerError.html
===
Then have users put the files you specify into their Web
directory (xxxxx/web/error/fileNotFound.html)
You can also add it to a particular site's .htaccess
**********
* SECOND *
**********
Create the "fileNotFound.html" using the "Refresh" function in the header.
=============
<HEAD>
<TITLE>File Not Found</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="10; URL=http://www.myhomepage.com/">
</HEAD>
=============
If you want to jump immediately to your homepage, I think you can just
reduce CONTENT="10; to 0 or 1.
You could have a page that says "unable to find the specific file, you
are now being redirected to our home page", or even better "our site map"
or "search engine". For a great example, check out this page:
http://www.tripod.lycos.com/SomeFileNotOnThisServerASDFASDF.htm
If people have better ideas, or notice something wrong, please post.
Ken Reilly