I have an index.php file in /api folder on my server. And I'm beginning with Slim and I'm trying to make a REST api.
So in my index.php I've got this:
$app->get('/', function() use ($db) {
echo "Get";
});
$app->post('/', function() use ($db) {
echo "Post";
});
$app->get('/test', function() use ($db) {
echo "Test";
});
And in my .htaccess file, as it was downloaded:
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]
If I make a GET call to ../api/ I've got "Get", the post call works fine too, but if I make .../api/test call I've got a 500 Internal Server error.
What am I doing wrong?
Thank you!