Mysterious route failure

I’ve been using Slim routes for a while now and never had an issue with a route not being matched/resolved. However, I’ve been banging my head against this one for a few hours now and I’m just not seeing what I’m doing wrong. Maybe someone here has an idea:

My route definition:

$app->get ('/test/execSql/{id}', 'App\Controller\TestController:execSql')->setName('test_execSql');

The URL for this route is generated like this:

$request = $app->getContainer()->get("request");
$router  = $app->getContainer()->get("router");
$url     = (string)($request->getUri()->withPath($router->pathFor('test_execSql', [ 'id'=> $k ])));

When I click on that link it takes me to the following (seemingly correct) page:


But the error message I’m getting is this:

The requested URL /Exchange/web/test.html/execSql/1 was not found on this server.

I’m not sure if the “test.html” is by design or points to some error. Like I said above, the URL seems to be generated correctly but it’s not resolved correctly.

Any ideas what might be causing this?

The message is from the webserver, not from Slim.

I guess you have something incorrectly configured in de webserver.

1 Like


Please try basics :

  • Load index.php with a phpinfo() make sure php alone working properly
  • Load a simple DB & PHP connection to make sure DB + PHP works fine ( f you have DB)
  • Load a minimal slim sample test to make sure minimal slim is working
  • If everything is ok, Need to Dig into your App Code.


1 Like

Thanks for your tips guys.

The interesting thing here is that this is in an existing application which has about 20 other routes and all of these other routes work without a hitch.

So I guess it’s like @Susanth.Com said: dig into the app code :frowning:

1 Like

Problem solved. Turns out I had an old test.html file in my /web directory which I had long since forgotten about. Once I remove this file, everything worked like a charm.

Feeling slightly stupid at this point :slight_smile:

1 Like