PDA

View Full Version : 404 woes - linux / php / apache


marcus-miller
16-08-2002, 04:34/04:34AM
Hi all,
a question for the techies here...

I have redesigned one of our sites, gone from huge static site to nice database driven dynamic site. The old site probs had about 300-400 pages.
This site handles all of that with 3 pages, some nice .php to disect the links and query the database and a little help from mod_rewrite.

www.mobilefun.co.uk
www.mobilefun.co.uk/index-mk4

I did a similar thing to one of our other sites earlier in the year. To help our users, I added a 404 handler page that asked the visitor to visit the new homepage.
While on the surface this seemed fine-n-dandy, bad things were happening!

- Every 404 generated resulted in a version of this page being served.

- Every missing page generates a 404
- Every missing image from the missing pages generates a 404
- The page contained about 30+ images, so for each failed page request from google or someones favs 30 versions of our new <bandwidth intensive> page was served.
- I noticed this on the stats after a week or so but it still resulted in one almighty bill from the company hosting our box.

- As not to lose visitors, most of which come from google I have a new 404 page but I would like to distinguish between requests for graphics and requests for pages.
( serve the 404 page when a page is requested, serve an empty page if 404 generated by an image )

What I want to know is:
how can I retain the url for the requested page to play with it with php to determine what to return with the 404 page???

ie.

if (pattern match("gif" or "jpeg" or "jpg") )
{
return nothing
}
else
{
display 404 page
}



any takers.. :confused:

Thanks friends

Marcus

ihelpyou
16-08-2002, 08:17/08:17AM
Any answers should go here:

http://www.ihelpyouservices.com/forums/showthread.php?postid=48968#post48968

No need to have two threads for the same post. Thanks.