Koozali.org: home of the SME Server

Error 404 Redirect

Mike Stoddart

Error 404 Redirect
« on: February 01, 2001, 02:08:40 AM »
I'm sure I asked this a long time ago, but I can't find the original post. How do I configure the server to use a specific html file for errors such as 404?

Thanks

Tim Litwiller

Re: Error 404 Redirect
« Reply #1 on: February 05, 2001, 01:59:46 AM »
here is how I did it.

add a template fragment , I called mine
87ErrorDocument

but probably should rather be 87ErrorRedirect but the name doesn't matter.  the number places it in the correct sequence in
the generated httpd.conf file after several tries this one worked but is probably not optimal as it is global to the entire machine - ie: all websites will look in thier root for the error document.

then put
ErrorDocument 404 /error.php

where /error.php is the path and file you want them to see on a 404 error.  You can use what ever file you want. The example is based on what I did not what you, exactly need to do.

I haven't got around to another idea that I have seen
and that is to put a argument on the end like
ErrorDocument 401 /error.php?error=401
ErrorDocument 403 /error.php?error=403
ErrorDocument 404 /error.php?error=404
ErrorDocument 500 /error.php?error=500
etc ...

that way you can have one file with the proper logic in it to
return the error messages the way you want for all the errors.

Mike Stoddart

Re: Error 404 Redirect
« Reply #2 on: February 06, 2001, 06:50:40 AM »
Thanks Tim, that worked a treat.