Why not simply check within the controller action (site/myportfolio)? It seems to me you don’t want dynamic controllers/actions? It seems you just want to load data if possible, otherwise fallback to default output.
Can you be more precise?
Note that you can forward or redirect to another controller-action if needed.
You can actually create a custom component that extends the CUrlManager component class and in that custom class override the processRules() method and load the rules from the DB.
In my system, my reseller can be able to edit or create their own pages and their own URL for that. This url can be mysite.com/myproducts. What I want is, my system first check this URL from database. If this URL exist than redirect to contentController to display this data, If it is not in URL like mysite.com/myshoppingCart, It goes Shoppingcart controller.
Hope I am clear this time.
Currently I am using ErrorHandler. Like mysite.com/myproducts. I don’t have myproducts controller that a reason it throws error and than I direct to page errorAction and then I check the database in the errorAction. But I am not happy with this. Because if the real error comes up, I can’t show properly.
Maybe it’s easier to override beforeAction in your base components/Controller.php to perform the DB query. If found, you can return false to supress any action.