DEV Community

Discussion on: Stopping .htaccess from handling API route

Collapse
 
devmazee2057282 profile image
dewbiez • Edited

Personally, I'd use a PHP HTTP router instead. Link all requests to something like index.php?uri=$1. That's how most frameworks do it. A lot less rewriting. And then they just pass $_GET['uri'] around.

And if the URI is /api/users/1 get the user by the ID of 1. Pretty simple.