I just added the Slim framework to my website in order to create a rest API. But I currently have a problem. I wrote this code as a test to check to see if a get request would work, but whenever I try calling the url, http://mysite.com/api/rest/hello/max, I get a website not found error. Please can you tell me what is going wrong?
Slim::init();
Slim::get('/hello/:name', 'hello');
function hello($name) {
echo "Hello, $name!";
}
Slim::run();
You have propably forgotten to put the
.htaccess
file provided withSlim
in the same directory as yourindex.php
.