R
R
Rustam Salavatov2015-02-23 00:47:52
MODX
Rustam Salavatov, 2015-02-23 00:47:52

How to convert apache rules to nginx for modx rest api?

Good afternoon, there is a code on apache
used in modex to create a rest api
, here is the code

RewriteEngine On
RewriteBase /rest/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php [QSA,NC,L]

here is a little description of .htaccess https://gist.github.com/splittingred/2346752

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rustam Salavatov, 2015-02-23
@fortunato

location /rest/ {

      if (!-e $request_filename){
              rewrite ^/rest/(.*)$ /rest/index.php?_rest=$1;
      }

      if (-e $request_filename){
              rewrite ^/rest/(.*)$ /rest/index.php;
      }
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question