subdomain in controller/action

Hello,

try to set a subdomain for a controller/action.

My controller is shaped account/user

where url is: mydomain.local/account/user/id/669

and I desire to be of the form:

username.mydomain.local

I have tried using the extension: yii-behavior-sluggable

and added a field "slug" in table user

and the model add:




         behaviors public function () {

             return array (

                 'Sluggable' => array (

                 'class' => 'ext.SluggableBehavior.SluggableBehavior'

                 'columns' => array ('username'),

                 'unique' => true,

                 'update' => true,

                 )

             );

         }



and add in config.php (urlManager):


'<slug: \ w +>. mydomain.local /' => 'account / profile'

but it does not work on localhost, there’s something I’m forgetting?

regards

I m not sure that following will address your problem but you may do the same in the controller.php by checking the url and either redirect or load the required controller/action

May this help

$baseurl = Yii::app()->getBaseUrl(true);

        if(substr(&#036;baseurl,0, 4) == &quot;http&quot;) &#036;baseurl = substr(&#036;baseurl, 7, strlen(&#036;baseurl));


        &#036;baseurl = explode( '.', &#036;baseurl);

// print_r($baseurl);

// print ">>".$baseurl[0]; die;

         if(Yii::app()-&gt;user-&gt;isAdmin() and (&#036;baseurl[0]=='uatadmin' or &#036;baseurl[1]=='uatadmin')){


             &#036;this-&gt;layout = 'admin';


         }else if(&#036;baseurl[0]=='uatadmin' || &#036;baseurl[1]=='uatadmin'){                 


                 &#036;this-&gt;redirect('/user/auth');


         }else if(&#036;baseurl[1]&#33;='uatadmin' and Yii::app()-&gt;user-&gt;isAdmin()){


             &#036;this-&gt;redirect('/user/auth/logout');


             


         }


        


    }

and I just check he did using the Site router will another way to accomplish.

http://www.yiiframework.com/forum/index.php?/topic/4645-dynamic-default-controller/

What exactly is not working? Can you generate the desired URL, or if it is not working when you visit username.mydomain.local? Did you set username.mydomain.local as pointing to 127.0.0.1?