Web Hosting Talk







View Full Version : ErrorDocument in php


Brutus
03-11-2004, 10:49 PM
Hello,

One of my client want use a php file for the 404 error code.
I use Cpanel.

I add in his .htaccess file the "ErrorDocument 404 /404.php" line,
but without result.

Then, I add the same line in the httpd.conf file, in his virtualhost section. No result...

Can you help me?

Best Regards.

Brightadmin
03-12-2004, 07:29 AM
Hi,

Upload the (404.php) file to the desired folder. (such as /errors/) Add the following line to the .htaccess file ErrorDocument 404 /errors/404.php

Make sure that your directory index have php extension. Also check with the permission of the file. Try to restart apache and check.

Regards,

Brutus
03-12-2004, 09:04 AM
Hi,

Thanks for the help.

But after theses changes, I still have the default 404 error page (white page from IE).

Apache is still searching for the 404.shtml page.

Regards.

chrisS
03-12-2004, 09:19 AM
Did you place the .htaccess in the root directory? Also, does the webserver have .hta defined?

Brightadmin
03-15-2004, 08:24 AM
Hi,

Please refer the following URLs. where You will get all steps regarding how to customize 404 Error document file in PHP.

1. http://www.devarticles.com/c/a/Apache/Trap-And-Get-Notified:-A-Practical-Solution-To-404-Errors-With-PHP/2/

2. http://www.devarticles.com/c/a/Apache/Custom-Error-404-Documents-with-PHP/

3. http://www.ibdhost.com/errors/

For general information - how to customize error documents using HTML file, please have a look into these URL's.

1. http://www.thesitewizard.com/archive/custom404.shtml

2. http://www.kuznetsov.uklinux.net/howto-error404.php

Regards,

Bright

:)

Brutus
03-15-2004, 08:51 AM
Thanks for the link.
:D

Brutus
03-16-2004, 12:55 PM
Hi,

I added the full path of the 404 error page in the .htaccess file (http://www.domain.com/404.php) and it works fine.

Thanks again for your help.