I did something similar once to handle a 'blog' site I had created a 
few years ago.

The blogger would have a special 'name' for a 'folder' on the website 
for their blog (instead of ?id=2343233)

When the site wanted to return a 404 error, it would send the user to 
this special 'search' page which would include the blogger's blog, if 
it existed (search on the database).  If the name did not match then 
the page would return a 'search result' as part of the 404 error to 
help retain the web browser on the sight by offering 'similar' blogs to 
the one they were looking for.

I worked very smoothly, I liked it alot.  Unfortunately, the company I 
had built that site for 'went in another direction' and recently 
'removed' the site altogether.  Now it is a Japanese porn site...  

Oh well.  It was cool when it was there.

William

-----Original Message----
-From: [EMAIL PROTECTED]
-Date: Sep 19, 2007 14:23 
-To: "CF-Talk"<cf-talk@houseoffusion.com>
-Subj: Re: Dealing with &#39;fake&#39; folders?
-
-Well a final report on the fake-folder situation, for those of you 
who 
-might find it useful:
-
-Turns out there were two bits I had to do:
-1) set the missing template header in the CF admin to point at my 
-handler script (cleverly titled "missingTemplate.cfm")
-2) set the '404' custom error in IIS for the site ALSO to point at 
that 
-script (as type "URL").
-
-Why both? Because the missing template handler would catch
-http://domain.com/folder/index.cfm
-but NOT
-http://domain.com/folder/
-
-as, since the folder doesn't exist, IIS doesn't go "oh I don't have 
a 
-page, let's go through the default page names set up for this site 
and 
-see if we find a match... index.cfm, yes, there it is" - so it never 
-touches the CF server at all.
-
-Then, in the missingTemplate.cfm script, I've got code to sniff out 
what 
-the non-existent folder *should* be (via cgi.script_name, and dig 
-through an app structure to see if it finds a match.
-
-Trick is, with the folder-only URLs, the ones that go through IIS's 
404 
-handler, cgi.script_name comes back as "missingTemplate.cfm", as 
that's 
-what IIS is redirecting to. However, cgi.query_string comes through 
as 
-"404;http://domain.com/folder";. So if I didn't find a match the 
first 
-way, I checked for that pattern in cgi.query_string and extracted my 
-non-existent folder that way.
-
-The rest was just a few path adjustments in my existing code, and all 
is 
-well.
-
-Fun with code!
-
-


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288853
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to