I have a folder in my project called api
, and inside it a .htaccess
file that should redirect the requests (made via jquery) to the app/controllers/rest/
folder which also has a file .htaccess
and a file named endpoint.php
, where requests are handled and where the interaction with the framework Slim.
The .htaccess file of the api
folder has the following parameters:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ ../app/controllers/rest/$1 [QSA]
The file .htaccess
of the app/controllers/rest/
folder 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();
When doing a request for url app/controllers/rest/foo
, it returns the result, however if request is done using the url api/foo
, the framework does not can identify the /foo
parameter.
Note: I am working in the Linux / ubuntu environment