Working With Dynamic Subdomain

Hi, I encountered some problems while working with subdomain. Our website is required to recognize subdomain for each user’s profile under the form username.site.com. I have set the rules to


'http://<username>.site.com' => 'profile/index'

and also configured the server to accept wildcard subdomain.

However, two problems occurred.

  1. The subdomain persists when you go to relative url. For example, if I have a url "/about" , the browser would bring us to username.site.com/about.

  2. The login session does not persist when you go to other user’s profile.

Could anyone help me solve these problems? :(

  1. use “www” as username :)

  2. set ‘cookieParams’ => array(‘domain’ => ‘.site.com’) for ‘session’ conponent in main config file.