CF Muse Reader (Megan @ cybersense) Asks:
A client wants to be able to send an email link like this, www.property.co.nz/23 - where 23 is the id of the property. I thought if I added some code to application.cfm I could detect this, and forward it to the right place but 404 reigns supreme. Can it be done and where do should I start?
Ah, this is easier than you think. The only tricky part is that it requires a change in your IIS or Apache settings. Here are the steps:
NOTE: See the comments for some additional nuances!
Create a file in the root of your site and call it "404handler.cfm" or something else equally obvious. Add code into the file that looks like this:
You should know that there is something of a performance penalty for doing this. Remember, many bots, agents and users generate 404 errors. Do yourself a favor and check your web logs for 404 missing files. those that are not "numeric" (as in your example) will show up there. Create static version of them so that Coldfusion doesn't have to waste time processing "typical" 404's and can focus on handling your property IDs.
Perhaps one of my Apache savvy readers can post the instructions for doing this in apache.