Hello guys. I have a problem with router and stuck a bit. Have a site (single page) multilang. If some try to open mysite.com/blah/ to be redirect in default language wich is "en" Here is my router:
$router = new \Phalcon\Mvc\Router(false);
$router->add('/{language:[a-z]{2}}/:controller', ['controller' => 2, 'action' => 'index', 'language' => 1]);
and when i try to redirect or forward with dispacher occur "Dispatcher has detected a cyclic routing"
Here is my controller and my beforeExecuteRoute
public function indexAction() {
echo 'blah';
}
public function beforeExecuteRoute(Dispatcher $dispatcher) {
$lang = $this->request->get('_url');
$lang = ($lang != '/en/' && $lang != '/de/') ? '/de/' : $lang;
$this->dispatcher->forward(array(
"controller" => "index",
"action" => "index",
"language" => $lang
));
return false;
}
I've try to init this in initialize function with $this->response->redirect(), but the result was the same