home/index - error 500

Hey guys.

I had on the domain a multi-module web made with phalcon, now i changed it to single module, and now my HomeController (that is default) on indexAction give me error 500, mention that only on indexAction, other actions from this controller work perfect, and the indexAction on others controllers works good aswell.

What is the problem?



44.2k
edited Feb '15

Try adding removeslashes on your router. Also with it enabled and disabled try typing it with a slash and without a slash. Also try adding $router->add("/", "home::index");



1.4k

tried and don't work...

post your index controller



1.4k

I don't have IndexController:

I have this route rules:

$router = new Phalcon\Mvc\Router();

$router->removeExtraSlashes(true);

$router->setDefaultController('home');
#$router->setDefaultAction('index');

return $router;

and here is my HomeController

use Phalcon\Mvc\Controller;


class HomeController extends Controller
{

    public function indexAction()
    {
        echo 'Index action!';
    }

    public function testAction()
    {
        echo 'Test action!';
    }
}


44.2k

Perhaps its an error in your webserver vhost?



1.4k
edited Feb '15

I think so, but i don't know what error, i checked a lot of time htaccess and other files that might display this error.. and no results...



13.0k
edited Feb '15

Hi,

What i suggest is to create a beforeExecuteRoute action on your baseController. This way you can see what controller and action is fired when hitting a route.

Here is some example code :

use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;

class HomeController extends Controller
{

    public function beforeExecuteRoute(Dispatcher $dispatcher)
    {
        $controllerName = $dispatcher->getControllerName();
        $actionName = $dispatcher->getActionName();
        $response = new \Phalcon\Http\Response();
        $request = new \Phalcon\Http\Request();       

        echo $controllerName;
        echo $actioName;
        exit;
    }

    public function indexAction()
    {
        echo 'Index action!';
    }

    public function testAction()
    {
        echo 'Test action!';
    }
}