1 Reply Latest reply on Aug 16, 2010 11:18 AM by Skemcin

    using 404.cfm template with application.cfc


      I am just getting started with application.cfc.


      I am trying to improve SE ranking with better URLs.  I would like to serve a page for non existent URLs.


      This works:



      The missing template handler catches it, and I can get the "24" (a db key) from arguments.template, to serve the proper page.


      However, I am having a problem with this url:




      This still calls 404.cfm, but I do not have arguments.template, and cgi.SCRIPT_NAME=/404.cfm


      I do not see any way to get the requested directory, /art-categories/van-gogh-24/, so that I can grab the key I need.


      Any idea on what to do?  How can I reference the path requested?

        • 1. Re: using 404.cfm template with application.cfc

          I'm pretty sure your issue is simply related to the fact that without a specific file referenced (like index.cfm in your first example) the web server (IIS) is managing the request - which is why the standard 440 page is used.  Even if index.cfm is defined as the default web page with the highest priority, the web server will still go through its motion and try to serve the next default page.


          The solution is to customize your error pages at the web server level.  There are a couple ways to do this -I have typically created one page, error.cfm, and then pointed all error pages in IIS to that page specifying which one in a URL query string, like type=404 or type=500.


          If you do not have access to customizing the web server error pages, contact your host and see if they can hook you with.  I point the following pages to error.cfm: 404, 404;2, 404;3, 405, 406, 500, 500;12, 500;13, 500;15, 500;16, 500;17, 500;18, 500;19


          Hope that helps.