开发者

What to choose for Yii based website: subdomains pointing to modules or separate yii-applications

开发者 https://www.devze.com 2023-04-07 03:43 出处:网络
I\'m making a website on yii which has several separate parts, each on it\'s own subdomain like themes.example.com, events.example.com e开发者_JAVA百科tc with main page example.com where these parts a

I'm making a website on yii which has several separate parts, each on it's own subdomain like themes.example.com, events.example.com e开发者_JAVA百科tc with main page example.com where these parts are listed. I will also need to authenticate users across subdomains. So i'm thinking what would be better: making each part as a yii module or making a separate yii application for each of these parts?


I think in your case it would be better to use modules. At least to have a single webroot directory. Using separate yii application would be appropriate for console part of your project. See this link for more information: The directory structure of the Yii project site


Well,

The features you are trying to accomplish from Yii its called "Parameterizing Hostnames". You need to create a module based structure in Yii.

At first you need to create a virtual host from apache and redirect that to your Yii project. On you Yii framework you need to change the URL manager from config.

'components' => array(
   ...
   'urlManager' => array(
      'rules' => array(
         'http://admin.example.com' => 'admin/site/index',
         'http://admin.example.com/login' => 'admin/site/login',
      ),
   ),
   ...
),

To know more about Parameterizing Hostnames

0

精彩评论

暂无评论...
验证码 换一张
取 消