Shoutbox

Apache 404 Error - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Apache 404 Error (/showthread.php?tid=31213)

Apache 404 Error by Ezra on 09-10-2004 at 09:59 AM

I want a customised 404 error page for my server, the page works, but my server does not show the page when a wrong url is typed.

How do I Configure Apache to show the customised 404 error page?

TIA


RE: Apache 404 Error by RaceProUK on 09-10-2004 at 10:26 AM

In .htaccess, enter the following line:
ErrorDocument 404 <url-to-404-page>


RE: Apache 404 Error by Ezra on 09-10-2004 at 10:28 AM

Already did that, it's not working :S


RE: Apache 404 Error by RaceProUK on 09-10-2004 at 10:30 AM

I don't actually know Apache very well, but you have to have .htaccess in the root of your website. Whether you have to have it elsewhere I don't know.


RE: Apache 404 Error by WDZ on 09-10-2004 at 04:33 PM

You don't need a .htaccess file anywhere, especially if it's your own server, because all that stuff could just be configured through httpd.conf.

See http://httpd.apache.org/docs-2.0/mod/core.html.en#errordocument for examples/info about using ErrorDocument.

quote:
Originally posted by Ezra
Already did that, it's not working :S
Maybe you could post the code you used? And where is the error document located?
RE: Apache 404 Error by Mippo on 09-10-2004 at 05:17 PM

I think usually .htaccess files are overridden unless it's changed in httpd.conf (or is it just me? :P) But if its your own server, using the httpd.conf for ErrorDocuments and stuff is handy :P


RE: Apache 404 Error by KeyStorm on 09-10-2004 at 05:43 PM

iirc, you can set your desired 404 target URL in the httpd.conf file.


RE: Apache 404 Error by Ezra on 09-10-2004 at 06:59 PM

I tried but I don't really know how all of it works.

There was this line in this httpd file with #ErrorDocument 404 /missing.html and I deleted the #, and named the customized 404 page missing.html.

But still no luck :s


RE: Apache 404 Error by WDZ on 09-10-2004 at 07:24 PM

And where is missing.html? I think it should be in the root directory of your web site. Also, make sure it's larger than 512 bytes, because IE doesn't like small error pages.


RE: Apache 404 Error by KeyStorm on 09-10-2004 at 07:46 PM

You should probably give the config an absolute path to your 404 page (since we don't know to what /missing.html is relative). For example:

ErrorDocument 404 C:/apache/htdocs/missing.html (try also using backslashes)


RE: Apache 404 Error by WDZ on 09-10-2004 at 08:08 PM

quote:
Originally posted by KeyStorm
ErrorDocument 404 C:/apache/htdocs/missing.html
That doesn't work... I just tried it on my server and Apache tried sending that exact path to the browser, which is obviously the wrong behavior.

Anyway, some more info... I tried his site and missing.html definitely exists in the root of his web space, but when you try to view a non-existent page, you get the default error along with "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." :-/

Edit: Ezra, do you still have the ErrorDocument line in a .htaccess file? If so, delete it, because it will override the httpd.conf.
RE: Apache 404 Error by Ezra on 09-10-2004 at 08:34 PM

No, I deleted the .htacces.

Still no luck [Image: throwpc.gif]