[CB 4.2] How to change the event and routed URL within an interceptor?

I have a URL like this http://domain/index.cfm/environment/module/handler/action

Now I want to remove “environment” out of the URL and continue processing,
so that /module/handler/action is executed.

Any ideas how to do this?

Thanks,

Gunnar

Hi Gunnar,

you can map your URL in Routes.cfm

Here is help Docs

http://wiki.coldbox.org/wiki/URLMappings.cfm

coldbox 4.0+
https://coldbox.ortusbooks.com/content/routing/

also if you are developing coldbox module then you can add route pattern in ModuleConfig.cfc as well.

Hi Sana,

thanks for the quick reply. I don’t want to have it routes.cfm file.

My idea is that the routes can stay untouched and it’s filtered out by the interceptor.

Best regards,

Gunnar

If you create a onRequestCapture interceptor and register it to run before the SES interceptor, you can modify the path info before SES gets to it.

Alternatively, you can provide a method in your routes.cfc to determine the path info and adjust it there.

http://wiki.coldbox.org/wiki/URLMappings.cfm#PathInfo_Providers

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad,

PathInfoProvider worked for me.