You are not logged in.
I'm trying to put a custom 404 page on my server. I added this line to /etc/httpd/conf/httpd.conf
ErrorDocument 404 /not_found.html
not_found.html is found in /srv/http, which is my DocumentRoot.
I've tried restarting the server, putting not_found.html in the ServerRoot, and even in /. I also tried changing "/not_found.html" to "notfound.html" and "@@DocumentRoot@@/not_found.html" and "/srv/http/not_found.html". Apache still serves up in the default "Object not found!" page when you request something nonexistent.
The other peculiar thing, possibly a clue, is that it still puts server information (version, OS etc.) at the bottom of the page, despite me having turned ServerTokens and ServerSigniature off, which is supposed to supress this information. These directives have had the desired effect on "index" pages - the line is doesn't appear.
Could anyone suggest why I can't seem to change this behaviour at all? Perhaps there is somewhere I could find some detailed logs of httpd's behaviour? /etc/httpd/logs/error_log just logs the fact that a nonexistent page was requested, not what action it took.
Thanks.
Last edited by bjackman (2012-01-17 19:39:06)
Offline
Try this:
in /etc/httpd/conf/httpd.conf search for <Directory />.
You'll find this:
<Directory />
...
AllowOverride None
...
</Directory>
change AllowOverride from 'None' to 'FileInfo' and put ErrorDocument 404 /not_found.html on the next line...
<Directory />
...
AllowOverride FileInfo
ErrorDocument 404 /not_found.html
...
</Directory>
I was able to replicate the problem on my server. The comments above the default <Directory /> line, in httpd.conf, should explain why this happens.
Last edited by lfitz (2012-01-17 04:12:25)
Offline
Try this:
in /etc/httpd/conf/httpd.conf search for <Directory />.
You'll find this:
<Directory /> ... AllowOverride None ... </Directory>
change AllowOverride from 'None' to 'FileInfo' and put ErrorDocument 404 /not_found.html on the next line...
<Directory /> ... AllowOverride FileInfo ErrorDocument 404 /not_found.html ... </Directory>
I was able to replicate the problem on my server. The comments above the default <Directory /> line, in httpd.conf, should explain why this happens.
Brilliant, exactly what I was looking for. Thanks very much.
Offline