假设域名为a.zf.com,现在准备将admin模块映射成admin.zf.com
参考了http://blog.newsoul.cn/post/69806.html这篇文章
配置虚拟主机,将域名指向文件夹
编辑YII配置文件
'user'=>array(
// enable cookie-basedauthentication
'allowAutoLogin'=>true,
'identityCookie'=>array('domain'=> '.zf.com','path' => '/'),
),
'session' => array(
'cookieParams' =>array('domain' => '.zf.com', ),
'timeout' => 3600,
),
// uncomment the following to enableURLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'http://admin.zf.com'=>'/admin',
),
),
'statePersister'=>array(
'class'=>'CStatePersister',
'stateFile'=>'protected/runtime/state.bin',
),
原文中'stateKeyPrefix'参数可以不要。该配置下的登陆cookie和原来的类似。不记住登陆的话,当前绘画期间有效。
目前模块中的url还有问题
转载于:https://blog.51cto.com/here2142/1540704