Skip to main content
Inspiring
October 25, 2010
Question

Search engine friendly 404 page.

  • October 25, 2010
  • 1 reply
  • 762 views

I would like to create a custom search engine(SE) friendly 404 page to handle 404 (Not found) and 404-like content. In theory I wanna do it from application.cfc page with a few lines of code. CF code needs to recognize the 404s, redirect to SE friendly 404-page.cfm (for example) and then to redirect to the index.cfm!? Is that possible? Please give me some example or tell me where to start.

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 25, 2010

    Well there's a server-wide missing template handler one can set in CF Admin, or an application-specific one one can set usintg onMissingTemplate() in Application.cfc.

    Configuring and Administering ColdFusion 9 > Using the ColdFusion Administrator > Server Settings section > Settings page

    http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf3638e6-7ffc.html#WSc3ff6d0ea77859461172e0811cbf3638e6-7ffb

    onMissingTemplate()

    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d2a.html

    --

    Adam

    pirula08Author
    Inspiring
    November 1, 2010

    I have been playing with onMissingTemplate() and my biggest concern here is that it actually can handle only .cfm pages.  For now I fully ageree with this solution because all of my pages come with a cfm extension, but again what about http://www.site.com/whatever/. Ideally it should be able to handle both http://www.site.com/page.cfm and http://www.site.com/whatever/ ?

    I forgot to mention that I am currently running ColdFusion MX 7 .

    Owainnorth
    Inspiring
    November 1, 2010

    If you're looking at implementing something like this then you need to look further than CF - as you say, it only ever gets given .cfm pages.

    You'll need to look at implementing a 404 handler at the webserver level (eg IIS or Apache).