coldfusion custom errors

Published by

Posted on February 15, 2008

Apache passes all .cfm files over to the coldfusion parse before it checks to see if it exists. For this reason Rewrite Rules and ErrorDocument directives in the vhost or .htaccess will not affect a non-existant page that ends in .cfm

The coldfusion administrator has a global 404 error page which it calls from /CFIDE/scripts/template.cfm which is mapped for all the sites on the server. The first thing the template.cfm file does is search for /errors/404.cfm, then if it doesn’t exist it will display a generic error message. To setup a custom error page just create a directory called ‘errors’ in the users htdocs directory and place the error document in there. Be sure to name it 404.cfm. Now any non-existant coldfusion pages should display your custom error page.

If you are having trouble with this check to see what the default missing template handler is.

  • Open the CFAdmin
  • Go to Server Settings -> settings
  • Check the Missing Template Handler, if it is blank replace it with “/CFIDE/scripts/template.cfm” and save those settings
  • Make sure the site has a CFIDE mapping