Custom Event Routing/URL Mapping?


I am very new to this framework, trying to evaluate whether it would
work for our current 12-year-old spaghetti-code extravaganza...

One hurdle to jump over is that our customer and their users are
extremely resistant to change. They are emphatic that all the existing
URLs continue working. Obviously switching to a front controller using
URL mapping/SES approach would cause every URL to change. Right now,
we use the old-school approach where each page has its own cfm that
acts as its own controller, essentially.

Besides forcing this unpopular change, has anyone else been able to
build, what I imagine would be, a custom URL mapping interceptor, or
are there any suggestions for how I might easily go about that (short
of setting up 10,000 redirects :))?

I'm imagining something that would dynamically change the front
controller at run-time, or be able to (auto-magically) recognize all
the cfm content pages as controllers, or else a totally custom
interceptor that will populate whatever event object/structure that
the SES interceptor is ultimately populating. I guess I'm basically
asking to use Coldbox without the front controller pattern...? :frowning:

Hope this makes sense and thanks for any insight,


Hi Jen,

Welcome to Coldbox! I had this same problem recently and was able to rectify by using the Coldbox invalid event setting. Once this is set you can evaluate where the user is trying to go and redirect accordingly.

Here is my invalidEvent method:

function invalidEvent(event){
var rc = event.getCollection();
var currentPageName = cgi.path_info;

var redirectPage = “”;
case ‘/overview.html’ : redirectPage = “overview”;break;
case ‘/foo.html’ : redirectPage = “partners/foo”;break;
case ‘/press.html’ : redirectPage = “press/index”;break;

if(redirectPage EQ “”)
var pc = getpagecontext();


Hope this helps.


That’s definitely one way. You can also use the missing template handler and when they hit the old and now missing front controllers you can easily know, redirect and such

Thanks for both of these suggestions. I'll give them a whirl!