Answer the question
In order to leave comments, you need to log in
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]
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question