Custom Adobe ColdFusion 404 error page

If you request a non existent page on a coldfusion site .It will not show up your normal Apache custom 404 page.

A trick to show a custom page ( eg: cferror.cfm ) when a non existant cfm page is accessed is:

Add the following entry to the .htaccess file in your DocumentRoot

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /cferror.cfm?%{REQUEST_URI}

All request to the non existent pages are passed to cferror.cfm page with the requested URL as argument

Posted under coldfusion

This post was written by Anoop Alias on May 7, 2008

Tags: