Jump to content

404 Page


sstangle73

Recommended Posts

i am tring to get 404 page data emailed to me. my .htaccess is

ErrorDocument 404 /404.php

  i would like to have this in the root folder above the individual domains but thats not as important as getting the 404 page right.

 

the 404.php page is

 

<html>
<head>
<title>Error!</title>
</head>
<body bgcolor="#000000">
<div style="color: #FFFFFF;">
Sorry, the page you tried to visit is not valid.  This error has been reported.  Any further questions can be directed to <a href="mailto:[email protected]?subject=404 Not Found">Steven Stangle</a>, WebMaster, ServerMaster.
</div>

<?php
   $from_header = "From: [email protected]\r\n";
   $to = "[email protected]";
   $subject = "404 Error";
   $today = date("D M j Y g:i:s a T");
   $ip = getenv ("REMOTE_ADDR");
   $requri = $PHP_SELF;
   $servname = getenv ("SERVER_NAME");
   $pageload = $ip . " tried to load http://" . $servname . $requri ;
   $httpagent = getenv ("HTTP_USER_AGENT");
   $httpref = getenv ("HTTP_REFERER");
   $message = "$today \n\n$pageload \n\nUser Agent = $httpagent \n\n$httpref ";
   mail($to, $subject, $message, $from_header);
?>
</body>
</html>

 

 

 

some times the emails come correct like this:

 

Tue Aug 5 2008 9:58:58 pm EDT 

67.240.55.105 tried to load http://shenentahasoccer.org/404.php 

User Agent = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 

http://www.shenentahasoccer.org/staff.html 

 

but most times the last line . . .where the error was found is omitted.

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/118422-404-page/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.