I’m currently writing a RESTful API for my service.
My url scheme is this:
http://www.mydomain.com/api/user – POST method, create new user
http://www.mydomain.com/api/user/id – GET/PUT method- Fetch/update user’s details
I wrote the userController.php on the server that handles those request and returns the right response. It’s on my server in the /api/userController.php
My question is how do I direct the above url’s (http://www.mydomain.com/api/user/ and http://www.mydomain.com/api/user/id) to activate the userController.php on the server?
Do I do it through the .htaccess file?
Thanks!
In your
.htaccessfile, replace this:with this: