Take the 2-minute tour ×

I'm trying to convert these rules from Apache rewrite to nginx:

RewriteRule ^([^/]+)/([^/]+)?$ api.php?version=$1&call=$2 [L]

I tried adding the following in the nginx config:


but I only receive a 404 error when I visit my site.

I want my URL to look like:


How can I convert these rules to nginx?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Add a / to your rewrite-destination and set the last flag.

rewrite ^([^/]+)/([^/]+)?$ /api.php?version=$1&call=$2 last;
share|improve this answer

Here are two converters, but double check the conversion output as well



share|improve this answer

Your Answer


