Craig asks:
Do you know how to handle MissingTemplate errors on the application level in CF7. I know CF8 has a new application function onMissingTemplate() that handles this but am having difficulties with this in CF7.
So Craig is right - this support is something that was added to ColdFusion 8, not 7. You can certainly add it to your Application.cfc but it won't fire automatically. (Folks, don't forget that Application.cfc can include additional methods!)
In ColdFusion 7, the only option you have similar is the Missing Template handler in the ColdFusion Administrator:

This is server wide, and unlike onMissingTemplate, you can't do processing before the file itself is loaded. So for example, if you want to say that any missing template with "store" in the URL should point to store.foo.com, you would need to put that logic within your CFM.
You do have access to the requested template information - but not via an explicit passed in arguments but rather the CGI scope instead.

So - it isn't quite as nice as onMissingTemplate, but it's something. I'm convinced that simply ignoring 404 requests is one of the biggest mistakes you can make on a web site (and I admit to this as well!).
Archived Comments
Thanks for the tip Ray. I was curious if you know where the coldfusion default onMissingTemplate template is located? Is this in the cf file system, or is this compiled at runtime? I would like to base my custom template from this.
There is a default response, but no default file you can edit. So if you want to modify the default you would need to make a 100% new file.
"I'm convinced that simply ignoring 404 requests is one of the biggest mistakes you can make on a web site"
Hey Ray, just wondering if you would ellaborate a little more on what you said here. The reason being, I'm playing around with using "onMissingTemplate" to help me spoof search engine safe urls under IIS and I want to see if I'm making a mistake before going to far.
In my example when someone enters in:
http://www.awesome.com/stor...
The onMissingTemplate method of Application.cfc will fire (since there will not be either a storefront directory or a lightsabers.cfm template). Lets say we parse the requesting URL in the onMissingTemplate method, figure out we're really going to:
http://www.awesome.com/inde...
So, technically, if someone punches in anything with a .cfm extension they should technically never get a 404 error in my app. At worst they will be redirected to the root of the site or perhaps the root of the storefront module.
@Steve,
If I were you I would still provide a means of catching a non-existing method, product whatever, instead of simply redirecting the user back to the startpage.
I blogged about using the OnMissingTemplate method a while back to do just what you are planning http://www.garyrgilbert.com...
if you don't have access to your host to add the isapi filters for your URL then the onmissingtemplate is really your only choice to do SES the way you want to do it.
@Steve: I'll ditto Gary. For cases where the URL does not match an expected pattern you want to log the request at minimum. This would let you see what's being requested that you aren't handling. Are folks coming to a typo version of your product name? Support the typo. Are folks looking for your competitors product? Create a page for that and talk about why your product is better.
@Gary & @Raymond
Gotcha, that makes sense. I had planned to take them back to a generic start page and if reasonable, try to suggest a page they might have intended to go to, but I can see the logic behind at least logging the request.
Thanks for the advice!
I like the way that mangoblog is doing their rewriting (mangoblog.org)
Are they using the missing template method or something else?
I like how whatever I have listed in the db for my articles appears in the URL.
Could someone help me understand the code needed to recreate this? I need to use clean URLs on other projects, but there does not seem to be a good, concise template set for this task. Not sure why.
i'm on CF7
BlogCFC does it too. ;)
There are a variety of ways of doing it. Here is one discussion: http://www.coldfusionjedi.c...