Common Yii framework folder for many applications

I think this is common problem, but somehow I can’t find solution for it (my mod rewrite knowledge is really week).

Lest imagine I’ve following structure on my server:

/root/blog/

/root/forum/

/root/framework

I wan’t to use /root/framework for both applications: blog and forum (in each index.php yii.php points to /root/framework/yii.php)

When I’m accessing my site via www.mydomain.com or www.blog.mydoiman.com I wan’t to use blog application, when www.forum.mydomain.com I want to use application form /root/framework.

How to write mod rewrite rules to do not brake including of yii.php?

Why don’t you configure 2 VirtualHosts in Apache for the two applications?

Problem is that I’m using external hosting. I can’t create vitualHosts, therefore I need to use mod rewrite (I think so…)

blog and forum are subdomains = vhosts

have a look at the demos folder/application-structure

each application there has its own subfolder, so you call domain.com/blog, domain.com/forum