0
I have a folder in my project called api, and within it a file .htaccess that should redirect the requests (made via jquery) to the folder app/controllers/rest/ which also has a file .htaccess and a file called endpoint.php, where the requests are treated and where interaction with the framework Slim.
The . htaccess folder file api, has the following parameters:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ ../app/controllers/rest/$1 [QSA]
The archive .htaccess of the briefcase app/controllers/rest/, has the following parameters:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ endpoint.php [QSA,L]
And the file endpoint.php has the following code:
$app = new \app\libs\Slim\Slim();
$app->get('/foo', function () {
echo '{"teste": "TESTE"}';
});
$app->run();
By making a request to url app/controllers/rest/foo, it returns the result, however if the request is done using the url api/foo, the framework cannot identify the parameter /foo.
Note: I am working on Linux/Ubuntu environment