2

I have an apache htaccess file used with Restful API tutorial

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ api.php [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ api.php [QSA,NC,L] 
</IfModule>

My nginx configuration currently is:

server {
    listen       80;
    server_name  example.org;

    access_log  /var/log/nginx/access.log  main;

    location / {
        index  index.php index.html index.htm;
        }

    error_page  404              /404.html;
    location = /404.html 

    error_page   500 502 503 504  /50x.html;
    location = /50x.html 

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

How do I convert it to the Nginx configuration with rewrite rules? The api.php is in the root folder.

1

0

You must log in to answer this question.

Browse other questions tagged .