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

Is there way to add a suffix into url

Just intermezzo, I want to add (dot) html at the end of each url. How should I do it?.

thx

You can extend router. For example:

$di->set('router', function(){
    $router = new \Phalcon\Mvc\Router(false);
    $router->add('/', array(
        'controller' => 'index',
        'action' => 'index'
    ));
    $router->add('/:controller\.html', array(
        'controller' => 1,
        'action' => 'index'
    ));
    $router->add('/:controller/:action\.html', array(
        'controller' => 1,
        'action' => 2
    ));
    $router->add('/:controller/:action/:params\.html', array(
        'controller' => 1,
        'action' => 2,
        'params' => 3
    ));
    return $router;
});

hmm .. is there any way that could be automated?

I mean, when I just write the url without (dot) html, the system will automatically add it.