I am looking for the best way to change the domain component of the url once the site visitor logs in. (ie set a new FULL_BASE_URL for the application)
eg if the site visitor arrives at the generic www.domain.com/login page and they successfully login, I want to check their details and see it they belong to a specific subdomain (subdomain.domain.com/afterlogin) and then automatically redirect them to the new subdomain with the same loginAction there were going to use as per AuthComponent.
I have tried injecting a ‘_host’ => ‘subdomain.domain.com’ into the array when I generate a route via router::url and it correctly forms the full text url with the new subdomain
eg. $newsubdomainurl = Router::url([’_host’ => ‘subdomain.domain.com’,
‘controller’ => ‘articles’,
‘action’ => ‘index’]);
When I use $this->redirect($newsubdomainurl) the domain component of the url remains unchanged.
So the short question is how do I go about this?