I have a problem with the Slim framework (version 2). If I run on the default page it shows the content without a problem but when I make a request for a route like $app->get('/test'...
I always get a 404 error.
This is my index.php.
<?php
require 'vendor/autoload.php';
\Slim\Slim::registerAutoloader();
$app = new Slim\Slim();
// Welcome message.
$app->get("/", function() use($app) {
echo 'Appointment API<br />';
});
$app->get("/test", function () use($app) {
echo "This is a test";
});
$app->run();
My .htaccess file:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
And my composer file:
{
"require": {
"slim/slim": "^2.6",
"slim/extras": "*",
"slim/middleware": "*"
}
}
To this point I don't really know what to do.