how can i make /home/ as my /index/

how can i make /home/ as my /index/ so that upon my website loads instead of /index/ it will trigger /home automatically?



85.3k

You can use:

$router->setDefaultController('home');

In your router

http://api.phalconphp.com/en/1.3.3/Phalcon/Mvc/Router#setDefaultController-details

edited Oct '14

still not working here is my code

$router = new Phalcon\Mvc\Router();
$router->setDefaultController(
    array(
        "controller" => "home",
        "action"     => "index"
    )
);
$router->handle();

i created a folder named router in my app folder and in my config.php i add 'routerDir' => DIR . '/../../app/router/',

also in my loader.php i add $config->application->routerDir,

am i missing somthing coz i still get IndexController handler class cannot be loaded on my screen



85.3k

It does not work like that, it must be:

$router = new Phalcon\Mvc\Router();
$router->setDefaultController("home");
return $router;