Note that there are some explanatory texts on larger screens.

plurals
  1. POYII redirect with subdomain
    primarykey
    data
    text
    <h1>Background</h1> <p>I am creating a web application using Yii, I am separating the site and supporting files from my application using sub domains. I am mapping my subdomains like so.</p> <pre><code>'urlManager' =&gt; array( 'urlFormat' =&gt; 'path', 'rules' =&gt; array( /* gii for developement, remove this in production */ 'gii' =&gt; 'gii', 'gii/&lt;controller:\w+&gt;' =&gt; 'gii/&lt;controller&gt;', 'gii/&lt;controller:\w+&gt;/&lt;action:\w+&gt;' =&gt; 'gii/&lt;controller&gt;/&lt;action&gt;', /* Sub domain mapping */ 'http://&lt;module:\w+&gt;.&lt;hostname:[^\/]+&gt;/' =&gt; '&lt;module&gt;/', 'http://&lt;module:\w+&gt;.&lt;hostname:[^\/]+&gt;/&lt;controller:\w+&gt;/&lt;id:\d+&gt;' =&gt; '&lt;module&gt;/&lt;controller&gt;/view', 'http://&lt;module:\w+&gt;.&lt;hostname:[^\/]+&gt;/&lt;controller:\w+&gt;/&lt;action:\w+&gt;/&lt;id:\d+&gt;' =&gt; '&lt;module&gt;/&lt;controller&gt;/&lt;action&gt;', 'http://&lt;module:\w+&gt;.&lt;hostname:[^\/]+&gt;/&lt;controller:\w+&gt;/&lt;action:\w+&gt;' =&gt; '&lt;module&gt;/&lt;controller&gt;/&lt;action&gt;', /* Website URL Mappint */ '&lt;controller:\w+&gt;/&lt;id:\d+&gt;' =&gt; '&lt;controller&gt;/view', '&lt;controller:\w+&gt;/&lt;action:\w+&gt;/&lt;id:\d+&gt;' =&gt; '&lt;controller&gt;/&lt;action&gt;', '&lt;controller:\w+&gt;/&lt;action:\w+&gt;' =&gt; '&lt;controller&gt;/&lt;action&gt;', ), ), </code></pre> <p>This is all working as expected, my problem is when I need to redirect between modules. Whenever I try and $this->forward() to another subdomain I end up in the same subdomain. </p> <h1>Example</h1> <p>When on app.examplesite.com I try and forward to www.examplesite.com/user/login but end up at app.examplesite.com/user/login</p> <p>$this->forward(Yii::app()->createAbsoluteUrl('user/login'));</p> <h1>Question</h1> <p>How do I correctly redirect from app.examplesite.com to www.examplesite.com/user/login?</p>
    singulars
    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.
    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