A Simple onMissingTemplate Example

ColdFusion Add comments

For the migration to Mango Blog, I wanted to preserve my previous RSS feed location (/rss.cfm). The new location is feeds/rss.cfm. With the availability of onMissingTemplate event handler for ColdFusion 8, making sure my RSS didn't break was a snap. Here's the snippet of code I added to Application.cfc.

<cffunction name="onMissingTemplate" returntype="void">
   <cfargument name="thePage" type="string" required="true">
   <cfif arguments.thePage is "/blog/rss.cfm">
      <cflocation url="/blog/feeds/rss.cfm" addtoken="false" />
   </cfif>
</cffunction>

Not the most elegant solution I've ever developed, but it keeps the RSS feed alive until I decide how I want to manage it the future...


5 responses to “A Simple onMissingTemplate Example”

  1. Geoff Says:
    Is the change of URL permanent? In which case, you should do a 301 redirect by adding statuscode="301" (In CF8) or

    <cfheader statuscode="301" statustext="Moved Permanently">
    <cfheader name="Location" value="/blog/feeds/rss.cfm">

    in CF7
  2. Paul Marcotte Says:
    Hi Geoff,

    Thanks for the tip! I'll add that immediately. :)
  3. va guru Says:
    I was looking for bread recipes. But this stuff is over my head.
  4. Coach bags Says:
    The farmer to kill the rooster is http://www.coachoutletmalls.com Coach factory outlet , then grabbed the hen to cock says: do not let you down when guangaoer! Rooster: do you think that I shaya his http://www.coachoutletmalls.com Coach bags mother, I continue her into a widow.
  5. UGG Says:
    <p><a href="http://www.uggbootsretails.com"; target="_blank">UGG Argyle Knit</a> features genuine twin-face sheepskin for refreshing comfort. It's one of our tallest boots and looks great all the way up or cuffed down. <a href="http://www.uggbootsretails.com"; target="_blank">UGG boots</a> in our Classic Collection feature a soft foam insole covered with genuine sheepskin and have a molded EVA light such as <a href="http://www.uggbootsretails.com"; target="_blank">UGG Sundance</a> and <a href="http://www.uggbootsretails.com"; target="_blank">UGG Bailey Button</a>, the flexible outsole designed for amazing comfort with every step. Beat the chill in superior style with the <a href="http://www.uggbootsretails.com"; target="_blank">UGG Ultra Tall</a>. The <a href="http://www.uggbootsretails.com"; target="_blank">Bailey Button 1873</a> of light and flexible outsole along with a suede heel guard provides durable wear all season long. Detailed with three oversized wood buttons, this style can be styled up and buttoned, slouched and slightly unbuttoned, or completely cuffed. <a href="http://www.uggbootsretails.com"; target="_blank">UGG Ultra Short</a> is also a good choice for people to refuge from the cold.Just buy one of the ugg boots for your family and yourself, it’s really a good gift both for you famlily and you.Action is better than thinking in heart.</p>

Leave a Reply



Powered by Mango Blog. Design and Icons by N.Design Studio