Custom 404 Error Message

Not necessarily a “scripty” thing, I keep meaning to set up my very own 404 error page, and I (a) don’t know how and (b) when I have been given instructions I lose them. So the Custom 404 File Not Found Error Document Message Tutorial that I found at Brandy’s site is a helpful thing for me to have around!

Jenn … 404 errors, uh, does that have something to do with .htaccess?!? Hmmmm…

20 Responses to “Custom 404 Error Message”

  1. Jennifer Says:

    duh… what’s that ;-) (ok, sorry for the inside joke… someone I know who REALLY SHOULD KNOW what .htaccess didn’t… and I’m still not over it) LOL

  2. Jennifer Says:

    Also… (actually posted on this site previously - but I’m bringing it up again since it’s relevant here too) was a link to snipe scripts where phpLinkRot is an excellent way to fix broken links. Basically it’s a custom 404 page with a PHP script on it that can capture the link the user was TRYING to get to but couldn’t. There’s an email form, they fill it out and send it to you so you know where the borken links are.

  3. marc Says:

    this is SO not related to this post but i’m not sure where to post general stuff :(
    love the site and it seems to be getting bigger every day (as it should i guess) i was thinking that a search function might be needed in the near future so that all us scriptidiots can find what we’re looking for.

    good/bad idea?

  4. Lynda Says:

    Marc, good idea. I think better organization might be in order too. Like sections for php, javascript, specifically, etc. But I’m really horrid at organization and if I try to suggest categories, every post will end up havng its own.

  5. Christine Says:

    I think it’s a great idea. I’ll get with Jennifer on it so that we can set it up - I have all the MT Search code ready to slide in to place. Search … coming soon!

  6. Kymberlie R. McGuire Says:

    Question from a clueless person here. :-) My site, like Christine’s, uses skins. Is there a way to set the 404 page up so that it changes based on your skin? Just curious.

  7. Amy Says:

    *shrug* I do it, but then again perhaps I’m doing it in a cheat-y way. My sysadmin configured my server so that it looks for a 404.php file in the root web directory. It uses that as the 404 file. I have it skinned like every other page on my site. Perhaps instructions on how to do this are included in the tutorial? (I’m in the middle of debugging a chunk of code, or I’d break concentration and check for myself.)

  8. Jennifer Says:

    Kymberlie - I think there’s a snippet of code at the top of your page that sets up the skin - I would imagine that you’d create the 404 with that same snippet of code…

    Don’t know if that makes sense… (

  9. Kymberlie R. McGuire Says:

    I wasn’t sure for some weird reason if that would work. No idea what I was thinking. :-) It works, thanks to Christine uploading my .htaccess file that I accidentally overwrote. LOL

  10. Christine Says:

    Teehee! Our lesson learned tonight? Make sure your FTP software is set to display hidden files - like the .htaccess file. Otherwise you might overwrite something you need - like the code that makes your PHP parse on your site. (Her skins were *poof* gone! I knew immediately what had happened too. Fast to fix!) If you have an existing .htaccess file, just add the line to it, don’t overwrite it!

  11. Row Says:

    That’s interesting, it’s the FTP software that displays it or not? Because on my new domain I see my .htaccess file (which gave me a 500, bah!) but on my old domain it would disappear into the ether after I uploaded it.

    I always keep a copy offline that I amend, anyway. :)

  12. Lynda Says:

    I think it depends on whether or not the server your on is configured to show hidden files. Most are, some aren’t.

  13. Row Says:

    I’m still getting the 500 when I upload the .htaccess file, whether I CHMOD it or not. Does anybody know why this might be happening? Could my host have a document higher in the tree preventing me using it? :(

  14. Lynda Says:

    Row, do you mean it’s giving you a 500 error when you try to access it in your FTP program (ie overwrite it with the new one, etc) ???

    If so, try changing the CHMOD to 777 and then try deleting it and uploading the new one.

    If you mean it’s giving your PAGE a 500 error (like you put the .htaccess file there and then every time you go to your index page you get a 500 error) it means something is out of whack inside your .htaccess file and it’s trying to direct to something or do something that isn’t really there.

  15. Row Says:

    It gives my page a 500 error. I thought I had everything right, all the .htaccess file was, was

    ErrorDocument 404 /rowf/error.php

    I thought that was the correct syntax, and that page exists. The error document can be a .php can’t it?

    BTW thankyou Lynda for answering my questions! :D

  16. Lynda Says:

    It can be php, mine is. I just tried everything just how you have it setup and I’m not getting any errors. Perhaps you should ask your host about it. They should know whats going on.

    Meanwhile, perhaps try putting the full URL in there?

    ErrorDocument 404 http://fullurl.com/rowf/error.php

    I doubt that will work, but I guess it’s worth a shot.

  17. Row Says:

    It must be a host thing, cause the full path didn’t work either :(

    I’ll ask him.

    I’m really disappointed. I went all geeky and even had a skin on the pages, and I can’t implement them!

  18. Row Says:

    “By default I have the .htaccess to only allow overriding authentication information. I have set it for your domain to allow you to override any directives controlling document types (FileInfo).”

    I’m too stupid to understand this. Is this basically his permission?

  19. Row Says:

    Hah! I should actually try these things out before posting inane comments here.

    It works! WOOHOOOOOOOO!

  20. Erica Says:

    Just posted something to my site that was relevant to this, and forgot to trackback :-P (I think it’s nifty at least!)