I'm trying to use the Slim PHP framework with IIS7. Now on some routes I keep getting a 404 from IIS which I find really confusing. Here's my index php:
require 'slim/slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->notFound(function () use ($app) {
echo("not found!");
});
$app->get("/books/:id", function($id){
echo("hello book " . $id . "!");
});
$app->get("/test",function(){
echo("testing");
});
$app->run();
On IIS (running PHP 5.3) I've setup the url rewritting to send all requests to my index.php file and disabled directory browsing. This seems to work fine as going to localhost/books/123 produces "hello book 123!". But when I go to localhost/test I just get a 404 error from IIS! If add a trailing slash to that url my slim notFound handler is triggered instead of my route handler.
If i create a directory called "test" it stops the 404 response but triggers the slim notFound handler rather than the defined route handler as I would expect. This seems really weird as I've disabled directory browsing.
I know my slim notFound handler is working ok as trying localhost/abc/xyz triggers the handler and works as expected.
Could anybody explain what is going on and why? Have I overlooked some configuration?
Thanks.