I'm currently building an API and I want people to be able to make calls like this:
http://mydomain.com/api/method.name.json?apikey=1234
Which will load to the following:
http://mydomain.com/api/index.php?method=method.name&format=json&apikey=1234&field1=1&field2=2
I am fiddling with some Mod Rewrite code but cannot get it to work. And I'm note sure how to add query strings (apikey=1234&field1=1&field2=2) onto the end of the URL.
Here's what I have so far and it's not working. It's giving me a 404:
RewriteRule ^([a-zA-Z\.]+).(json|jsonp|xml|php)+)$ index.php?method=$1&format=$2 [L]
Is what I am trying to achieve possible? Thanks in advance!