I am using INVO example app from here:
https://github.com/phalcon/invo
I have copied all the files and set the db and base url.
It works, I can login etc.
however, I wanted to learn how to use redirects e.g.
I would like to use contact-us
instead of contact
without changing the name of the controller.
So, I created a file routes.php inside of the app/config folder and put this inside:
<?php
$router = new Phalcon\Mvc\Router(false);
$router->add('/contact-us', array(
'controller' => "contact",
'action' => "index"
))->setName('contact');
$router->handle();
return $router;
and I have created this in my bootstrap file index.php in the public root directory
$di = new \Phalcon\DI\FactoryDefault();
$di->set('router', function(){
require __DIR__.'/../app/config/routes.php';
return $router;
});
However, it's not working and when I try to access http://localhost/test/contact-us
it works, but http://localhost/test/contact-us
stopped working and I am redirected to the homepage.
If I (comment the route) do this:
/*$router->add('/contact-us', array(
'controller' => "contact",
'action' => "index"
))->setName('contact');*/
$router->handle();
return $router;
Neither http://localhost/test/contact-us
nor http://localhost/test/contact-us
works ;(.
If I uncomment it back. contact-us
works but contact
don't.
I guess it's b/c of ->setName('contact')
and it's stored in the memory or in some file.
how to get it back to the original state and "unset" that?