Note that there are some explanatory texts on larger screens.

plurals
  1. POYii urlManger when working with subdomains
    primarykey
    data
    text
    <p>I want to ask about pecularities of Yii urlManger when you are working with a module, which was assigned a subdomain.</p> <p><strong>Here is what I need to do:</strong></p> <p>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.</p> <p>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:</p> <pre><code>'https:// online.example.com/&lt;action:(signin|signup)&gt;' =&gt; 'secure/default/&lt;action&gt;', </code></pre> <p>Now the tricky things..</p> <p><strong>1. How can I createUrl() from this module back to the site?</strong></p> <p>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'.</p> <p>Currently I do a workaround:</p> <pre><code>'http://'.$mainDomain . '/' =&gt; 'site/index', 'http://'.$mainDomain . '/news' =&gt;'site/news', </code></pre> <p>where $mainDomain is just fixed 'example.com' string. But this doesn't always work. For example it doesn't work for returnUrl</p> <pre><code>Yii::app()-&gt;user-&gt;setReturnUrl(array('site/index')); </code></pre> <p>will get me to 'https:// online.example.com/secure/site/index'</p> <p>and the second important question:</p> <p><strong>2. How to restrict subdomain ONLY to serve the module linked to it?</strong></p> <p>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'</p> <p>That shouldn't work this way! Sub-domain assigned to module should serve only that module.</p> <p>I can't find anything usefull in documentation. Maybe somebody have some ideas, how to deal with that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload