• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cf 404 error handling in shared environment

LEGEND ,
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

Hi -

My sites in a hosted environment and I want to control 404 dead bad links
and the page that is served to users. Being on a IIs web server i can
naturally create custom pages and set within my hosting control panel a html
custom page.


This is fine for html pages 404 like
www.mysite.com/thispagedoesnotexist.html

but what's the easit way to handle cfm page dead links and get around the
default (yucky) cfm error page that is displayed by the CF server.
www.mysite.com/thispagedoesnotexist.cfm


On all my CF pages i have error handling that catches any error (database,
etc) emails me the details and presents a custom page. Naturally because the
entered .cfm page in question does not exist, obviously 404's wont get
catered for by this error handling.

Any help appreciated.


TOPICS
Advanced techniques

Views

464

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

check out onMissingTemplate() method of Application.cfc
more details are in the cfml ref manual and cf dev guide.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

yeah nice fetaure, but i'm in a shared environment without access to the CF
adminitstrator.

"Azadi" <azadi@sabai-dee.com> wrote in message
news:glb11q$chu$1@forums.macromedia.com...
> check out onMissingTemplate() method of Application.cfc
> more details are in the cfml ref manual and cf dev guide.
>
> Azadi Saryev
> Sabai-dee.com
> http://www.sabai-dee.com/


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

LATEST
you DO NOT need access to CF Admin for this at all!

all you need is to use Application.cfc (instead of Application.cfm) and
add <cffunction name="onMissingTemplate"><!--- code to handle missing
files ---></cffunction> to it.

you can download the CF Dev Guide pdf (and CFML Reference) from
adobe.com - they have full details on how to use Application.cfc.

there are also numerous blogs with good examples of Application.cfc
usage. check out Ray Camden's blog ( http://www.coldfusionjedi.com/) for
a sample Application.cfc file and, i think, Ben Nadel
( http://www.bennadel.com/) has some good onMissingTemplate() method
examples, too.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation