I want to ask about pecularities of Yii urlManger when you are working with a module, which was assigned a subdomain.
Here is what I need to do:
I need to put "login", "signup", "book" and some other actions behind SSL, and for some reason SSL certificate is signed for a subdomain eg online.example.com.
I've created a Yii module "secure" for all actions which require SSL, and assigned a sub-domain "online.exmaple.com" to it as follows:
'https:// online.example.com/<action:(signin|signup)>'
=> 'secure/default/<action>',
Now the tricky things..
1. How can I createUrl() from this module back to the site?
For example: createUrl('site/idex') from module would create url: 'https:// online.example.com/site/index' And I need an url back to 'http:// example.com/site/index'.
Currently I do a workaround:
'http://'.$mainDomain . '/' => 'site/index',
'http://'.$mainDomain . '/news' =>'site/news',
where $mainDomain is just fixed 'example.com' string. But this doesn't always work. For example it doesn't work for returnUrl
Yii::app()->user->setReturnUrl(array('site/index'));
will get me to 'https:// online.example.com/secure/site/index'
and the second important question:
2. How to restrict subdomain ONLY to serve the module linked to it?
Now for example, if I go 'https:// online.example.com/site/index' (note: default action for module would be 'default/index') it will get me to my site homepage. It shouldn't. or I can access any other module with: 'https:// online.example.com/mymodule/default/index'
That shouldn't work this way! Sub-domain assigned to module should serve only that module.
I can't find anything usefull in documentation. Maybe somebody have some ideas, how to deal with that?