I'm trying to write a rewrite rule in my .htaccess file that has the following behavior. I'm doing it for an API which is located at a real location in the form of:
https://www.domain.com/apifolder/entry.php?call=testcall&data=testdata
The API call is routed starting from entry.php and eventually delivers the appropriate response. Essentially my entire API lands upon a large switch statement of valid API calls. The problem is, that URL is not very nice. I'm trying to replace it with a URL of this form:
https://www.domain.com/api/testcall?data=testdata
I have gotten close with the following rewrite rule:
RewriteRule ^api/([^/]+)/? /apifolder/entry.php?call=$1 [L]
However, the desired example above does not work, because there first parameter that seems to coming in (data, which is in reality the second parameter), is led by a ?. If I try the url:
https://www.domain.com/api/testcall&data=testdata
where it's led by a & instead, then it works perfectly fine. This looks weird to me too, sadly. Is there anything I can do to let the rewritten URL take in the query string beginning with a ? instead?