Re: 404 errors

From: Date: Tue, 16 May 2006 21:08:20 +0000
Subject: Re: 404 errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236302@lists.php.net to get a copy of this message
John Taylor-Johnston wrote:
I get a lot of 404 errors. Is there a way in PHP to redirect them in such a way as it does not burn my bandwidth? Or (an Apache trick I learned once) to discourage them by referring them to localhost? Or something? Something I can embed in PHP.
IMHO unless there's a very good reason for it PHP should never get involved in handling 404 errors. By the time it gets to PHP it's wasted a fair amount of capacity. On most of my sites, where I don't need to handle 404's intelligently (i.e. showing a search results page based on the entered URL) I use the following in the apache configuration... ErrorDocument 404 "404 Not Found" That simply makes PHP return 404 Not Found which is about the minimum amount of bandwidth you can get away with. -Stut

« previous php.general (#236302) next »