I am trying to convert this apache .htaccess rule to something nginx can use.
This .htaccess is a part of this tutorial to make a php REST api. ( http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-23/ )
The idea of this .htaccess file is to make a REST get/post request to "task_manager/v1/register/" and it redirects you to "task_manager/v1/index.php"
.htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
I've tried one idea from stackoverflow, one from winginx, and I tried writing one myself and they all sort of flop.
Nginx config:
something I tried and failed so I commented it out.
rewrite ^/task_manager/v1/(/)$ /task_manager/v1/index.php redirect;
something I saw in stackexchange and didn't help, so I commented it out
rewrite ^task_manager/api/v1/([^/]+)/([^/]+)/?$ task_manager/api/v1/index.php?class=$1&method=$2? last;
was recommended to use winginx, didn't work. :c
location / {
if (!-e $request_filename){
rewrite ^(.*)$task_manager/v1/index.php break;
}
}
Please advise me.