We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Site load problems

Hi

I launched my project on a server but loads have problem randomly! somtetimes site won't load or loading have a very very low speed.

I have set some routing. is it cause of load problems? my routing:

    $di['router'] = function() {

        $router = new \Phalcon\Mvc\Router(true);
        $router->setDefaultModule('frontend');

        $router->add('/admin', array(
            'module' => 'backend',
            'controller' => 'index',
            'action' => 'index'
        ));

        $router->add('/admin/', array(
            'module' => 'backend',
            'controller' => 'index',
            'action' => 'index'
        ));

        $router->add('/admin/:controller/:action/:params', array(
            'module' => 'backend',
            'controller' => 1,
            'action' => 2,
            'params' => 3
        ));

         $router->add('/admin/:controller', array(
            'module' => 'backend',
            'controller' => 1,
            'action' => 'index'
        ));

        $router->add('/index', array(
            'module' => 'frontend',
            'controller' => 'index',
            'action' => 'index'
        ));

        $router->add('/', array(
            'module' => 'frontend',
            'controller' => 'index',
            'action' => 'index'
        ));

          $router->add('/:controller/:action:(new|[0-9]+)', array(
            'module' => 'frontend',
            'controller' => 1,
            'action' => 2,
            'id' => 3
        ));

          $router->add('/admin/:controller/:action:(new|[0-9]+)', array(
            'module' => 'backend',
            'controller' => 1,
            'action' => 2,
            'qid' => 3
        ));

        return $router;
    };

sorry if my english isn't very well.



4.8k

I think you might want to keep one of these:

    //This
  $router->add('/admin', array(
        'module' => 'backend',
        'controller' => 'index',
        'action' => 'index'
    ));

  //or this
    $router->add('/admin/', array(
        'module' => 'backend',
        'controller' => 'index',
        'action' => 'index'
    ));

I have some problems in routing . Do you know how to redirect from one module to another?