I have a problem with a redirect in Zend Framework 2. when a user enters a url like http//mysite.test/lorem, he will be redirected to http//mysite.test/news/view/lorem-ipsum.
the code:
$redirecttable = $sm->get('Redirect\Model\RedirectTable');
$route = $redirecttable->getRedirectByRoute($this->params()->fromRoute('page'));
if($route) {
// $route->getToroute() returns "news/view/Lorem-Ipsum"
return $this->redirect()->toUrl( $route->getToroute() );
}
Am I making a stupid mistake here?