PDA

View Full Version : 404 woes...


marcus-miller
15-08-2002, 12:14/12:14PM
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.

old - www.mobilefun.co.uk
new - 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???

any takers.. :confused:

Thanks freinds

Marcus

( i have just realised this may be a bit off-topic, I will understand if it is not replied to or removed )

highman
15-08-2002, 12:23/12:23PM
moved to the php forum, seems more in tune with the topic

ihelpyou
15-08-2002, 12:31/12:31PM
Okay. Where are the php experts? :)

highman
16-08-2002, 06:31/06:31AM
no php experts in the house? Big D?

One point marcus, it is a good idea to deliver a custom error page, but why not construct one that dosent deliver any images back to the user?

Were all the old pages in a paticular directory, enabling you to look for that directory in the url? and then deliver the page based on that...

Just thinking out loud... not sure I totaly understand the problem

JuniorHarris
01-09-2002, 12:17/12:17PM
Like highman, I'm not sure I fully understand the problem...however you posted in another thread a question about retaining the 404 string? I don't use php, but in ASP, the first thing my 404 handler will do is get the query string [Request.ServerVariables("QUERY_STRING"). This typically will appear as 404;http://www.domain.com/404url.htm. The 404 (error) is removed, and the resultant URL is then dissected as necessary.

I've never had an issue with missing or removed pages generating more then one 404 request...so I'm not sure what is up with that.