I am using url based languages and i have a page with incoming parameters in URL.
I do not like query strings ('?x=y') or named params ('x:y') in URL so i use http://localhost/cakeapp/us/controller/action/param1/param2/param3
In my AppController i am checking if the URL has language defined, if no language is defined (for example the user requests http://localhost/cakeapp/controller/action/param1/param2/param3) then i want to simply redirect the user to the language defined URL with the same parameters.
In Short: I want to redirect:
http://localhost/cakeapp/controller/action/param1/param2/param3
to
http://localhost/cakeapp/us/controller/action/param1/param2/param3
I use;
$this->redirect(
Router::url(array('language' => $this->Session->read('Config.language'), 'base' => false))
);
But it redirects user to http://localhost/cakeapp/us/controller/action without parameters.
Is there a way to build url using Router::url with incoming $this->passedArgs variable.