RewriteEngine On
RewriteRule ^api/?(.*)$ public/index.php?route=$1 [QSA,L]