Link to home
Start Free TrialLog in
Avatar of cbestal
cbestal

asked on

Custom 404 Error for .cfm files with IIS

I want to have a custom error page (404.cfm) to be loaded when someone types in a bad URL for a coldfusion page.

I am running IIS 5 and Coldfusion 4.5.

I already have IIS set up to display a custom page for .htm for .html files.  When I type in http://www.server.com/notthere.cfm I get a standard 404 error message that reads:

Error Occurred While Processing Request

Error Diagnostic Information

An error has occurred.

HTTP/1.0 404 Object Not Found

Thanks in advance,
Chris
Avatar of danrosenthal
danrosenthal

This is a ColdFusion setting. Go to CF Administrator (generally located at "http://www.servername.com/cfide/administrator/index.cfm")

And enter the path to your error page in MISSING TEMPLATE HANDLER under the SETTINGS section.
yes that shld do it !

just incase u dont have access to CFADMIN.
u can type in the following in ur "application.cfm"

<CFERROR TYPE="Exception" Template="Custom404Error.cfm" MAILTO="Admin@urdomain.com">
Avatar of James Rodgers
>>This is a ColdFusion setting. Go to CF Administrator (generally located at "http://www.servername.com/cfide/administrator/index.cfm")

>>And enter the path to your error page in MISSING TEMPLATE HANDLER under the SETTINGS section.

Dan,

how does that apply to other sites on the same server, will they all receive the same 404 page or can it be set up for each top level directory?

or would anands solution be better in that scenario?

Avatar of cbestal

ASKER

>>just incase u dont have access to CFADMIN.
>>u can type in the following in ur "application.cfm"

>> <CFERROR TYPE="Exception" Template="Custom404Error.cfm" MAILTO="Admin@urdomain.com">

I tried to have my hosting company change the settings in the Admin, but they referred me to documentation on CFERROR.  I have tried using CFERROR to take care of this , like anand wrote above, but it doesnt work.

Here is what I have currently in my application.cfm file:

<cfapplication name="CatalogSecurity" sessionmanagement="Yes" setclientcookies="no" sessiontimeout="#CreateTimeSpan(0,0,50,0)#">
<!--- If an error occurs, display this page---->
<CFERROR type="request" template="error.htm">
<CFERROR type="exception" template="error.cfm">

Any more suggestions on how to get this to work using the CFERROR tag?  I am testing this by entering http:/www.servername.com/notthere.cfm where notthere.cfm does not exist.

Thanks.
SOLUTION
Avatar of danrosenthal
danrosenthal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dan,
thanks fro the info,
look in the CF section for your points
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>All the settings on CFADMIN cater to all applications running on ur server. hence to custmise each u'll need to use the tags that allow u to customise each setting thru application.cfm
If u notice - u can set "almost" everything up from application.cfm - just as u can from CFADMIN !

unfortunately the system architecture requirements at my location require that *almost* every page have its own directory, therefore each dir would need to be updated... and its a lot
Avatar of cbestal

ASKER

Thanks for the help on this one.  I split the points because this question grew as it went on.  I could not figure out how to get a custom 404 error through <CFERROR> as Dan said, I don't think there is a way.

I used Anands recommendation of setting up IIS to look for .cfm files and then direct to a custom 404 page, and that seems to be working well.

Thanks again,
Chris