Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Router ignores baseurl

My router seems to ignore the base url set in the url service and sets 'phal' as controller in for instance http://server.com/phal/index/index. Why is that? My service loader:

$di->set('url', function () use ($config) {
    $url = new UrlResolver();
    $url->setBaseUri('/phal/');

    return $url;
}, true);


//Registering a router
$di->set('router', function(){
    $router = new Router();

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

    $router->removeExtraSlashes(true);
    return $router;
});

The code worked on windows with xampp bot I can not make it run on debian nginx



64.3k

maybe location configuration problem ?

can you post the nginx config please



2.0k
Accepted
answer

I fixed the error by remoing /phal from url passed by nginx