You can set up an error document for Apache in your .htaccess
ErrorDocument 404 /my404.php
It will then show that page instead of the normal 404. You can then customize that 404 to include some text like “Where you looking for this? go here! Looking for that? Go there! Something else? Check our FAQ! Still not sure? Here’s our home!”, or include any search functionality you might have, etc.
A 404 with some nice that tries to help and guide people where to go from there is better than the lame white default apache 404
by the way, IE browsers have a tendency to show their own 404 if the size of the markup is below some value (I think it was 4k or something). Just put a whole bunch of lorem ipsum in HTML comments to stop it from doing that and show your 404 instead of it’s own which actually makes it look as if your website is totally broken (whoever came up that a browser wide 404 would be a good idea …)
So if I put that code in my .htaccess - which is currently located in my Web Root - and I also have a corresponding “my404.php” in my Web Root as well, then that is guaranteed to always come up if I have a broken link?? :-/
(I’d probably use my website template and just put a message in the center pane so it still looks like they are on the website but the particular page just isn’t coming up. That should be more than 4k.)
guaranteed is such strong word, but yeah, it will always show /my404.php when a requested URI wasn’t found.
By the way, it’s 512 bytes (not 4k) to get IE to show your message instead of it’s own. Mind you that that’s only HTML; CSS, JS, images, etc don’t count!
Just to be clear, we are talking about internal links ONLY with regard to .htaccess, right? If I link to sitepoint.com/gobbledegook, I’m going to get SP’s 404 regardless of what my .htaccess file says.
For internal 404’s, MODx users have the Notify404 extra, which will send you an email whenever a “not found” message is returned. I suppose other popular CMS’s have something comparable. (Personally I had to turn this off as myopic bots were triggering too many false positives.)
Allaire’s HomeSite used to do it across your pages. Man, I miss that program sometimes. (I know it got bundled in with Dreamweaver, but it just isn’t the same.)