Jump to content

500.shtml and 404.shtml


kingb00zer

Recommended Posts

Hi when I tried to login to my site for the first time I got a message that said I could find the errors in my error logs. I checked it and the error is that I have no 500.shtml and no 404.shtml I also had no favicon.ico but I looked into that and made one (which is good I didnt know what the url icon i wanted to eventually add was called until now) but I dont know what to do about 500 and 404.shtml, shouldnt it usually come with my host and server package?

Link to comment
Share on other sites

As far as I know, it doesn't come with any because you have to add your own. I know some do have them already installed though. It isn't really a big deal if you don't have them, when you come across those errors it will tell you that you don't have pages set for those errors. You can usually set the pages in the ErrorDocument or .htaccess settings of your hosting site if your web host allows you to add them. Personally. I use a PHP page. I set it up so I didn't have to create a page for every error (404.shtml, 500.shtml, etc.). It's pretty simple actually. If it's any help to you, I'll post it. For every error document I simply did: ErrorDocument 400 error.php?err=400ErrorDocument 401 error.php?err=401ErrorDocument 403 error.php?err=403ErrorDocument 404 error.php?err=404ErrorDocument 500 error.php?err=500ErrorDocument 503 error.php?err=503 This is error.php:

<?php  $url = ($_SERVER['QUERY_STRING']) ? basename($_SERVER['PHP_SELF'])."?".$_SERVER['QUERY_STRING'] : $_SERVER['PHP_SELF'];  $uri = (basename($_SERVER['REQUEST_URI']) != $url) ? "<b>".basename($_SERVER['REQUEST_URI'])."</b>" :  "This page";  $err = (isset($_GET['err'])) ? $_GET['err'] : "";  switch ($err) {	case '400':	  $til = "Error 400 - Bad Request";	  $txt = "<h4>$til</h4>\n".			 "<p>The server detected a bad request in the client's request.</p>\n";	break;	case '401':	  $til = "Error 401 - Unauthorized";	  $txt = "<h4>$til</h4>\n".			 "<p>Client unsuccessfully tried to access a password protected page.\n".			 " If you do have a valid password/username please go back and try again.</p>\n".			 "<div><img src=\"401.gif\" alt=\"401.gif\" /></div>\n";	break;	case '403':	  $til = "Error 403 - Forbidden";	  $txt = "<h4>$til</h4>\n".			 "<p>Server configuration does not allow you access to this area.</p>\n";	break;	case '404':	  $til = "Error 404 - Page Not Found";	  $txt = "<h4>$til</h4>\n".			 "<p>$uri was not found. If you typed in the web \n".			 " address manually please make sure you don't have any spelling\n".			 " errors and try again.</p>\n".			 "<div><img src=\"404.gif\" alt=\"404.gif\" /></div>\n";	break;	case '500':	  $til = "Error 500 - Server Error";	  $txt = "<h4>$til</h4>\n".			 "<p>This site has encountered a server error. This is most likely\n".			 " the cause of an error in a server-side script, therefore it is\n".			 " temporary. Please check back in a few minutes and try again.</p>\n";	break;	case '503':	  $til = "Error 503 - Service Temporarily Unavailable";	  $txt = "<h4>$til</h4>\n".			 "<p>The server is currently unable to handle the request due to a\n".			 " temporary overloading or maintenance of the server. The implication\n".			 " is that this is a temporary condition which will be alleviated\n".			 " after some delay.</p>\n".			 "<div><img src=\"503.gif\" alt=\"503.gif\" /></div>\n";	break;	default: header("Location: error.php?err=404");  }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>   <title><?php echo $til; ?></title>  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />  <meta name="robots" content="noindex, nofollow" /> <style type="text/css">  html, body {	font-family: 'Lucida Console','Courier New';	color: black;	background-color: white;  }  h4 {font-size: 20px; margin-bottom: 10px; border-bottom: 1px solid red;}  p {font-size: 14px;}  div {text-align: center; padding-top: 10px;}</style> </head><body> <?php echo $txt; ?> </body></html>

Link to comment
Share on other sites

Hey it doesnt seem to work, I assume because on my server I have to do these 5 pages individually. And if they arent all that important how would I go about fixing them or better yet knowing what the problem is so I can isolate it and fix it. I suspect it is in my connection file but I am almost certain I have those details correct (might not be server= localhost.)

Link to comment
Share on other sites

Ok I managed to find some basic examples of all of these shtml files and now I get "Error: HTTPd: malformed header from script\ checklogin.php" No idea what this means or why it is happening, it works just fine when i use it in my xampp server.I should add, this is what I get form my error log

[Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"503.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"404.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:18:30 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"404.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"503.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:17:33 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"404.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"503.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:03:45 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"404.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"503.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:02:31 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:35 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:35 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"503.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"404.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/404.shtml, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url][Mon Feb 06 01:01:18 2012] [error] [client 115.69.41.57] File does not exist: /home/druglord/public_html/"401.gif, referer: [url="http://drug-lords.com/checklogin.php"]http://drug-lords.com/checklogin.php[/url]

There is nothing wrong with checklogin.php it works perfectly when I run the site through xampp. I am lost..

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...