Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
routing and 404
  • this question is not so much about fuel, but about some logic I came up with this routing 'system' for an online store where the homepage is already the catalog (list, for list of products): '_root_' => 'list/index',
    '_404_' => 'base/404', 'product/(:any)' => 'product/index/$1',
    'pages/(:any)' => 'pages/index/$1', '(:any)' => 'list/index/$1' so, to navigate and filter the list you use, for example: http://www.tshirts.com/brand/xx/color/blue/size/medium the problem with this is that you'll never get the 404 page
    since whatever you type will get you the list controller…
    if the filters doesn't exist, they won't be applied the big question is: is this unsafe or 'bad practice', to not have an 404 displayed page for unvalid url's?
    is there another way you'd do this kind of routing?
  • As you correctly observed, you can not have AND an (:any) route, AND a 404 route, as the any will capture everything. If you have a need for an any route, you'll have to deal with 404 situations in the controller that your any route points to. You can trigger a 404 from your controller by using throwing a Request404Exception.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion