Forum Moderators: phranque
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.
[edit]URL's snipped
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 friends
Marcus
( i have just realised this may be a bit off-topic, I will understand if it is not replied to or removed )
[edited by: NFFC at 3:20 pm (utc) on Aug. 15, 2002]
In that case you can probably use Apache Server's mod_rewrite to rewrite the old URLs and "feed"
(point) them to your handler script.
The exact implementation depends on the form of the original URLs and the parameter order needed
by your handler script.
However, there are some conditions under which this won't really work to preserve the context of the
original requests. A discussion of a similar URL rewriting problem and a warning about the loss of
context is here [webmasterworld.com].
You may wish to review your log files in further detail: An image can't be called for by a page that
doesn't exist, so I'm not sure why you're getting all those failed image load requests... Old cached
copies of your pages somewhere out on the Web, maybe. This mystery probably doesn't affect your
main problem, though - It's just strange.
I hope this is helpful to you.
Jim
I have kinda formed a work-a-round for this but thats a good point about the images being called by non-existent pages.
< dives back into his log files >
But it was the case that images were generating 404's - strange!
Im using mod rewrite to redirect whole directories where the content is not (.gif¦.jpg¦.jpeg¦.png) to our new index page and the 404 handler will pick up whatever is left.
I dont think there is a perfect way for us to do what we want to do, we just gotta wait untill the site gets re-spidered and the search engine((s) only really care about google) update the site layout
Anyway, thanks for your time. :-)
Marcus