phpnginxmagentomagento-1.7magento-rest-api

Magento 1.7 REST API nginx configuration


Magento 1.7 has new REST API and it also has new rewrite rules for .htaccess file. How can I rewrite new rules in nginx?

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

Solution

  • Here you go:

    location /api {
      rewrite ^/api/rest /api.php?type=rest break;
    }