<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 404 Error Handling</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/</link>
	<description></description>
	<pubDate>Fri, 05 Dec 2008 03:02:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Yoshi</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11087</link>
		<dc:creator>Yoshi</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11087</guid>
		<description>I use a similar approach. I used to also have it record to a db as well, but I dropped that. now I settle for just an email, with a referer link (so i know if it's from a search engine, etc), and the ip address of the visitor (so i can determine if it's a bot). I could send you my code if you'd like.

In the .htaccess, it's exactly like they say if you're running apache:

ErrorDocument 404 /404.php 

(or whatever you name your 404 file)</description>
		<content:encoded><![CDATA[<p>I use a similar approach. I used to also have it record to a db as well, but I dropped that. now I settle for just an email, with a referer link (so i know if it&#039;s from a search engine, etc), and the ip address of the visitor (so i can determine if it&#039;s a bot). I could send you my code if you&#039;d like.</p>
<p>In the .htaccess, it&#039;s exactly like they say if you&#039;re running apache:</p>
<p>ErrorDocument 404 /404.php </p>
<p>(or whatever you name your 404 file)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Roub</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11088</link>
		<dc:creator>Paul Roub</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11088</guid>
		<description>Of course, you can extract a lot of this from your logs if you have referrer logging turned on.  However, for ease of reporting and juggling, on one of my higher-traffic sites I keep a simple not-found table:

notfound_id, int, primary key, auto-increment
notfound_date, timestamp
notfound_url,  varchar(255)
notfound_referer,  varchar(255)
notfound_ip, varchar(25) 
notfound_useragent, varchar(255)

And my 404.php page writes to it as follows:

header("Status: 404 Not Found");

$url = $_SERVER["REQUEST_URI"];
$referer  = $_SERVER["HTTP_REFERER"];
$clientip = $_SERVER["REMOTE_ADDR"];
$useragent = $_SERVER["HTTP_USER_AGENT"];

$sql = 'insert into notfound (notfound_url, notfound_referer, notfound_ip, notfound_useragent) values ( ' .
    "'" . mysql_escape_string($url) . "', " .
    "'" . mysql_escape_string($referer) . "', " .
    "'" . mysql_escape_string($clientip) . "', " .
    "'" . mysql_escape_string($useragent) . "')";



// assuming an existing mysql connection
mysql_query($sql, $dbconn);</description>
		<content:encoded><![CDATA[<p>Of course, you can extract a lot of this from your logs if you have referrer logging turned on.  However, for ease of reporting and juggling, on one of my higher-traffic sites I keep a simple not-found table:</p>
<p>notfound_id, int, primary key, auto-increment<br />
notfound_date, timestamp<br />
notfound_url,  varchar(255)<br />
notfound_referer,  varchar(255)<br />
notfound_ip, varchar(25)<br />
notfound_useragent, varchar(255)</p>
<p>And my 404.php page writes to it as follows:</p>
<p>header(&#034;Status: 404 Not Found&#034;);</p>
<p>$url = $_SERVER["REQUEST_URI"];<br />
$referer  = $_SERVER["HTTP_REFERER"];<br />
$clientip = $_SERVER["REMOTE_ADDR"];<br />
$useragent = $_SERVER["HTTP_USER_AGENT"];</p>
<p>$sql = &#039;insert into notfound (notfound_url, notfound_referer, notfound_ip, notfound_useragent) values ( &#039; .<br />
    &#034;&#039;&#034; . mysql_escape_string($url) . &#034;&#039;, &#034; .<br />
    &#034;&#039;&#034; . mysql_escape_string($referer) . &#034;&#039;, &#034; .<br />
    &#034;&#039;&#034; . mysql_escape_string($clientip) . &#034;&#039;, &#034; .<br />
    &#034;&#039;&#034; . mysql_escape_string($useragent) . &#034;&#039;)&#034;;</p>
<p>// assuming an existing mysql connection<br />
mysql_query($sql, $dbconn);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11089</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11089</guid>
		<description>You see - this is where I think something might be screwed up in the way I'm handling 404 errors to begin with. For me - on my 404 page - $_SERVER["REQUEST_URI"] will BE the 404 page. Like it "forgets" what was being asked for - and only remembers the current page - which IS the 404 page... 

But as far as I know - I have the 404 page pointed correctly in my .htaccess... I must be overlooking something!</description>
		<content:encoded><![CDATA[<p>You see - this is where I think something might be screwed up in the way I&#039;m handling 404 errors to begin with. For me - on my 404 page - $_SERVER["REQUEST_URI"] will BE the 404 page. Like it &#034;forgets&#034; what was being asked for - and only remembers the current page - which IS the 404 page&#8230; </p>
<p>But as far as I know - I have the 404 page pointed correctly in my .htaccess&#8230; I must be overlooking something!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11090</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11090</guid>
		<description>A HA!!
The problem was that I had the .htaccess line like this:

ErrorDocument 404 http://www.mysite.com/404.php

instead of

ErrorDocument 404 /404.php

Strange. By putting the "full web path" in there - it loses what was "being asked for"... Now maybe I"ll try that email script again...</description>
		<content:encoded><![CDATA[<p>A HA!!<br />
The problem was that I had the .htaccess line like this:</p>
<p>ErrorDocument 404 <a href="http://www.mysite.com/404.php" rel="nofollow">http://www.mysite.com/404.php</a></p>
<p>instead of</p>
<p>ErrorDocument 404 /404.php</p>
<p>Strange. By putting the &#034;full web path&#034; in there - it loses what was &#034;being asked for&#034;&#8230; Now maybe I&#034;ll try that email script again&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yoshi</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11091</link>
		<dc:creator>Yoshi</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11091</guid>
		<description>Wow, I've never encountered that, but I would wager to say it's just how your web server is setup. This is good to know!</description>
		<content:encoded><![CDATA[<p>Wow, I&#039;ve never encountered that, but I would wager to say it&#039;s just how your web server is setup. This is good to know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11092</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2004/03/18/404-error-handling/#comment-11092</guid>
		<description>WOAH! Well... the good news is that it works... the bad news is that the 404 page gets a lot more traffic than I realized. LOL!! I think I have to make my own script that keeps a list of "missing pages" - but only &lt;b&gt;one entry per missing page&lt;/b&gt; (ie. no duplicates). Perhaps finally after a long hiatus, this is a chance for me to post a home-grown script... should be simple enough.
</description>
		<content:encoded><![CDATA[<p>WOAH! Well&#8230; the good news is that it works&#8230; the bad news is that the 404 page gets a lot more traffic than I realized. LOL!! I think I have to make my own script that keeps a list of &#034;missing pages&#034; - but only <b>one entry per missing page</b> (ie. no duplicates). Perhaps finally after a long hiatus, this is a chance for me to post a home-grown script&#8230; should be simple enough.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.290 seconds -->
