[Coldbox 4.0.0] Module Route Rewrite

Hi there,

I moving/creating a section of a site into a module:

Section/Module: Products
Old Route: http://sitename.com/en/products
Module Route: http://sitename.com/products/en

Question: Is there a way to intercept ‘products/en’ and rewrite it as ‘en/products’ ?



Are you using a rewrite module for the Application Server or just relying on SES URLS in ColdFusion. If the former, I would had a rule to do that there.

You could also do it with a preProcess interceptor and change it on the fly, or even use the roues to do this. But it would be hard as the module (products) is not the first in the line so the /en/ will be seen as the route instead.

Found it…

Thanks PathInfoProvider() :slight_smile:

Amazing little function!


oooh, thats much neater than the preProcess way I was doing it. When I converted over to ContentBox, all the old routes of blogcfc, I honored for a little while by doing the preProcess and checking it.

Luis, or Brad, if you’re reading this would an interceptor on this be beneficial as well?

Into PathInfoProvider() I convert the URL into an Array, after checking some logic, I then switch array elements into new positions, then convert the array into a list again and return it as the new path.
This maybe not the perfect way of doing it, but it works for me… for now.

New situation:
I still trying to figure out how to make this work (example):


I can verify from a valid list of categories if the path requested is trying to go to an existing category, but how can I instruct coldbox to go to “:en/:product/list” when category validation return false?
by default if I go to: “:en/:product/list” Coldbox is trying to send me to “:en/:product/:category” I switch pattern positions, but that did don’t work either… Any one?