Route all requests to the same handler and look for an app or a user with that name at run time and decide which one the is being requested. If a username is the same as one of your app names, you’ll need to decide which one takes precedence.
In both cases, I’m assuming you have a rewrite rule that adds index.cfm back in and that all requests are processed by ColdFusion (as opposed to some other rewrite engine)
You could do this entirely with a rewrite engine if the routes were all static, but I assume they are not and need to be dynamic and based on a database.
URL Rewriting will allow you to do all sorts of funky stuff. Just list your known apps first in your rewrite rules in IIS, Apache or any other solution.
Then, you can use a general mapping to pass all other requests to your MVC ColdBox Application.
Incoming: domain.com/ → rewrite to → domain.com/index.cfm
So long as you have difference Application.cfc/cfm files in your /apps/app1 directory you will not be bound to the ColdBox framework. This is the same solution presented by Brad but you don’t need to organize your URLs into categories like /user/*** or /apps/***.
Thank you guys for your input. Got some more Q's or clarifications.
Notes:
- By a none mvc app, I mean a traditional app that is not using any
framework
- These apps have their own Application.cfc's
- No user will share the same name as the app dir
- users will need to access their profile via domain.com/usename
- Users profile page is dynamically generated from the database
- Hosted on IIS 7.5
Just a recap, one option is to have the apps located in an apps folder
i.e. domain.com/apps/app1
But if the applications will not have the same name as the users, then
the applications can stay in the wwwroot folder, then add a static
route to each app, right?
So, for me to have SES url's and have user profiles be accessed via domain.com/username, I'll have to implement
Question: Supposing that the contact page is found in domain.com/
contact it would mean that no user or application should be named
'contact' right?
While this is so, how will coldbox know if it is a page or if it is a
username or user profile? Will I need to add a route for each page
then dynamically route the rest to load the user profile.
Would this be the way forward?:
- No username or page or app should share the same name
- Statically route apps & pages
- dynamically route the rest to user profiles
Yes, as long as your application is in /whatever-your-app-is-called and that directory has its own Application.cfc AND your rewrite rules check to make sure there is not a physical directory before rewriting to /index.cfm your applications should work just fine.
Hi Aaron, I am learning the interceptor, and was looking at your post and the coldbox forgebox, but I could not find the reservedRoutes.cfc file and it shows 404 error…i am missing anything? Thanks for your help and contributions! -Tony