I am attempting to redirect API calls to api.php with parameters, however it does not work.

RewriteCond %{REQUEST_URI} ^/widgetapi
RewriteRule ^widgetapi/(.*)/(.*)$ api.php?action=$1&string=$2 [L]

How do i accomplish this? I would like each and every call much like /widgetapi/cook/bacon map to /api.php?action=cook&string=bacon. At this time it appears that something is rewritten, however i see whitened page rather than api.php output.

Apache version is 2.2, rules have been in .htaccess, RewriteEngine is On (other Web addresses are rewritten as intended).

Okay, this rewrite rule appears to operate. Whitened page was really api.php output because I have written $items = [] rather than $items = array().