I'm using an addon domain with my Hostgator account, and I want to change the 404 error page for this domain. Hostgator has a thing where you can change error pages, but I think that changes it for all domains on that account. I only want to change it for this one domain. Is that possible? I Googled it and tried something with the .htaccess file but it didn't change anything.
You must put the errordocument directive in the respective addon domain folder for it to be processed by that documentroot
this is my 404 page setup, call it 404.php <?php $sendMail = "no"; // must be set to "yes" for the email to be sent $emailAddress = "you@yourdomain.com"; // set to your email address putenv('TZ=EST5EDT'); // set to your time zone // change nothing below this line $domain = $_SERVER['HTTP_HOST']; $page = $_SERVER['REQUEST_URI']; if ($sendMail == "yes") { $errortime = (date(" F d h:ia")); $browser = $_SERVER['HTTP_USER_AGENT']; $referer = $_SERVER['HTTP_REFERER']; $IP = $_SERVER['REMOTE_ADDR']; $message = ""; $message .= "Time of the error: $errortime\n\n"; $message .= "browser: $browser\n\n"; $message .= "Page Requested: $domain$page\n\n"; $message .= "Referer: $referer\n\n"; $message .= "IP Address: $IP\n\n"; $name = gethostbyaddr($IP); $message .= "Hostname: $name\n\n"; mail($emailAddress, "404 Error" , $message, "From: Website <>"); } header("HTTP/1.0 404 Not Found"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="refresh" content="1;url=http://www.sawz.com/"> <title>404 - where oh where?</title> <style type="text/css"> A:link {text-decoration: none; font-weight:bold; color: blue} A:hover {color: red} </style> </head> <body> <div style="width: 400px; position: absolute; top: 45px; left: 50%; margin-left: -200px;"> <span style="color: teal; font-size: 32px;">file not found</span> <br /><br /><br /> <span style="color: black; font-size: 18px;"> (oops) <br /><br /> it appears you were looking for <br /> <span style="color: teal; font-size: 18px;"><?=$domain?><?=$page?></span> <br /><br /> however, since you are here, it is clear you did not get what you wanted. <br /><br /> the problem has been reported so any broken links can be found and repaired. <br /><br /> you can click <a href="javascript:history.go(-1)">here</a> to go back to your previous page. </span> </div> </body> </html> Code (markup): then add this to your htaccess: ErrorDocument 404 /404.php Code (markup): works for me.
I've tried pointing the ErrorDocument to a bunch of different places - the root, different pages, and nothing works. I think it has something to do with Hostgator.
Thanks, I figured out the problem. I went to your site and typed in a wrong page and I got the same generic 404 error. I was using IE7, so I tried FF and your 404 page showed up. So it's just an IE7 issue.
I tried that and it didn't work. I did some more googling and found that I needed to uncheck "Show friendly HTTP error messages" in my Internet Options. Now it shows my Wordpress 404 page, which is good enough. I still can't get the ErrorDocument thing to work, but I'm probably putting it in the wrong place in the .htaccess file. I did try putting it before #Begin wordpress and after #End wordpress and neither worked.