Page 1 of 1

Custom error pages

Posted: Sun Oct 23, 2005 6:38 am
by Ree
Is it possible to redirect a user to a custom error page using PHP only in case some server error happens (such as 404)? Or is it only possible by configuring Apache itself? I'm asking this since I would like to have this functionality on shared hosts which do not allow server configuration.

Posted: Sun Oct 23, 2005 8:00 am
by feyd
last I saw, shared hosts often pointed to a 404 page in your document root..

Posted: Sun Oct 23, 2005 2:14 pm
by Ree
You mean, if I put my own 404 page in the docroot, it would be used instead of the server default one?

Posted: Sun Oct 23, 2005 11:19 pm
by hanji
You may be able to add a .htaccess file in your webroot. I'm not 100% sure if this will work at the htaccess level, but this is standard vhost configuration option on Apache. Of course.. this is assuming that your site is running on Apache webserver...

Code: Select all

ErrorDocument 404 http://www.yoursite.com/error.htm
ErrorDocument 403 http://www.yoursite.com/error.htm
Hope this helps
hanji