参数不起作用的细长路径

I'm trying to setup Slim for me application i've got issue that route with parameters not working.

This is my index.php

require 'Slim/Slim.php';

\Slim\Slim::registerAutoloader();

$app = new \Slim\Slim();


// GET route
$app->get('/', function () {
    print "hello";
});



$app->get('/books/:id', function ($id) {
    print $id;
});

$app->run();

This is the .htaccess file

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

Request to / works fine, but if I pass /books/1 it returns [404] not found

Man your mod_rewrite is not enable in apache.For enable mod_rewrite follow this.Reference http://www.kingpabel.com/apache-mod-rewrite/

<Directory /var/www/html>
AllowOverride All
</Directory>

//enable mod rewrite
a2enmod rewrite

//restart apache
service apache2 restart