Using mod_rewrite for a RESTful api
- by razass
Say the user is making a request to the following url:
"http://api.example.com/houses/123/abc"
That request needs to map to "/webroot/index.php" and 'houses', '123', 'abc' need to be able to be parsed out of the URL in that index.php. It also can't alter the http headers or body.
There can be any number of variables after the domain ie) "http://api.example.com/houses/1234/abc/zxy/987"
I think I already have all requests being sent to webroot using:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $0 !^webroot/
RewriteRule .* webroot/$0 [L]
</IfModule>
Which appears to be working but I am not sure if it is correct.
But now I am at a loss as to how to take the next step as mentioned above.
Thanks in advance!