In my app I have different rules for different virtual hosts. The context decides how the URLs appear to the user.
You can’t specify dynamic rules directly in the config file, because Yii has not loaded by that point. This gives you the ability to make decisions on routing with the full framework at your disposal and before any rules have been evaluated.
I handled the domain language recognition in the entry script, before Yii is even loaded… That’s maybe not the best way, but it also redirects aliases to default url, adds www if necessary (i.e. there’s not a subdomain in the request), etc. So I think it’s faster if it’s done before Yii is called and starts to work.
Back to the topic, would your method work for what I’m looking for? I’d like to test it but I’m really a newbie with Yii, and I don’t even know where to put your class file