1831147 Members
2648 Online
110020 Solutions
New Discussion

Linux/Apache

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

Linux/Apache

I am running RH9 and Apache. My web guy asked me to do him a favor. When a user connects from our NT protal Web to My linux server to look up web reports. And the document they are looking for isnt there, they get a crazy error that confuses them. Is there a way that I can change that '404' error to 'Document not Found or something like that. I am not sure where this would be configured, the main index.html page????10xRPM
UNIX IS GOOD
4 REPLIES 4
Mark Grant
Honored Contributor
Solution

Re: Linux/Apache

I'm not sure where Red Hat keeps it but it supposed to be /etc/apache and the file is called httpd.conf. Actually I think REd Hat keeps it in /etc/apache/conf but I could be wrong.

In this file, you'll file a sesction on customizable error response. I think the bit you want to change uncomment is

ErrorDocument 404 /missing.html

This will display "missing.html" instead of the standard 404 message.

When done either restart apache or "kill -1" the "httpd" process that has a parent of 1
Never preceed any demonstration with anything more predictive than "watch this"
Sergejs Svitnevs
Honored Contributor

Re: Linux/Apache

You can add ErrorDocument directive to the end of /etc/httpd/conf/httpd.conf:

ErrorDocument 404 "Document not found"

and then restart httpd service.

Regards,
Sergejs
Jerome Henry
Honored Contributor

Re: Linux/Apache

Setting up a missing.html file will solve most of the issues.
Search in httpd.conf for
#ErrorDocument 404 /missing.html
uncomment (take # out), and make sure missing.html is in your / path (usually /var/www/html).

Some of your clients, though, won't use server page and display their own error 404 page. There's not much you can do from the server side, except making missing.html as simple as possible (html, text, no image but .gif or .png, no swf or other fun stuff).

hth

J
You can lean only on what resists you...
Steven E. Protter
Exalted Contributor

Re: Linux/Apache

You should see an error in the error_log, the location of which is defined in httpd.conf

This will tell you exactly what resource is bing requested, what the error is and what the source IP address(user) was.

This should be enough to track down the error.

httpd.conf is usually in /etc/httpd/conf

error_log usually is in /etc/httpd/logs

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com