Add url routing to existing Lucee site

I’m looking for an easy way to add routing for “pretty urls” to an existing site.
My existing site uses file paths, e.g. “http://example.com/systemadmin/adminmain.cfm”, but I’d like to be able to use routes like “http://example.com/admin”, “http://example.com/admin/users”, etc.

So far, the only solution I’ve found is using CommandBox/ColdBox and setting up routes in server.json, but it seems that could be a huge pain to convert the site and all existing client installations to run under CommandBox.

Is there a common lightweight routing library available for Lucee? Or would it be possible to just install the router from CommandBox separately?

I’d like the existing urls to just work as-is, but if I get something that doesn’t point to an actual file path, I could use nginx rewrites to map, e.g. “http://example.com/admin” to “http://example.com/index.cfm/admin”, and then in /index.cfm, I could use a router library to map the url path “/admin” to the file “/systemadmin/adminmain.cfm”.

Yes, I could just roll my own… :stuck_out_tongue:
It doesn’t seem that complicated…but there may be complications/edge cases that I’m not thinking of, and I’d rather not take a bunch of time reinventing the wheel for what is, essentially, a cosmetic issue…

1 Like