Hi fuelers, quick question I'm hoping someone can help answer. Within the routes.php, I'm trying to detect and "re-route" an incoming url that has get parameters but my attempts don't seem to be matching and thus, not re-routing. Below is a slightly simplified version of what I'm trying to do. Anybody got an idea? Thanks!
return array( '_root_' => 'welcome/index', // The default route '_404_' => 'welcome/404', // The main 404 route
// Just trying to match the exact incoming URL, nothing fancy with the param number
'api/places?event_id=1' => function () { return \Response::forge(View::forge('flatfile/place1')); }
You can not route on GET variables, only on URI segments. Fuel hasn't been designed to work with GET variables, the router doesn't even see that, it only sees the URL. It uses URI segments for everything (including parameters), although obviously the use of GET variables is supported.
A quick way around it is using a rewrite rule, rewriting "api/places?event_id=1" to "api/places/event_id/1".