Forum Moderators: phranque

Message Too Old, No Replies

custom 404

I've made a custom 404 but I don't know whether or not I did it right...

         

karmov

12:34 am on Mar 25, 2004 (gmt 0)

10+ Year Member



So I felt smart and I thought I'd make a nice friendly page for my users that occasionally mistype a URL and get a 404. I did it in apache using

ErrorDocument 404 urltomyerrorpage

I felt pretty good about it until I read the following thread [webmasterworld.com ] where jdmorgan mentions that:

"There is a very large number of mis-configured servers on the Web, many of which will not generate a 404-Not Found response under *any* circumstances."

So I checked out the headers returned when I purposely seek out a 404 on my site. I get a 302 to redirect and then a 200 once I'm redirected to the custom page.

So I would like to know what my options are here. Am I trying to have my cake and eat it too? Did I just miss something in my configuration? Should I drop the idea of a custom error page? Should I not care about the fact that my webserver has infinte URLs? I'm tryting to figure out whether I'm trying to do the right thing in the first place, and if I am, how to implement it properly... Any suggestions?

jdMorgan

2:08 pm on Mar 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



karmov,

Use ErrorDocument LocalURLPathToYourPage and *not* a full URL. Do not include "http://www.yourdomain.com/" in this path, otherwise the server will treat this as an external redirect and generate a 302 response code instead of the desired 404. This behaviour is documented in the Apache ErrorDocument description [httpd.apache.org].

Jim

karmov

7:52 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



All fixed up now. Thanks a lot jdmorgan. Amazing how little you read when you're in a hurry to do something. I read that exact document to figure out how to do it in the first place, well not so much read as scanned... Well not so much scanned as glanced at... Lesson learned. Thanks again.