Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Routes using :any
  • I have my routes.php files like below: return array(
    '_root_' => 'welcome/index', // The default route
    '_404_' => 'welcome/404', // The main 404 route
    '(:any)' => 'main/$1',
    ); This works fine routing pages to the folder "main" until I enter a web page that does not exist. This should cause a 404 error, however what I get is: Fuel\Core\Fuel_Exception [ Error ]: It appears your _404_ route is incorrect. Multiple Recursion has happened.
    COREPATH/classes/request.php @ line 125 Am I doing something wrong or is there a better way to set up the routing? I solved this by changing the routes to the following (added 3rd line): '_root_' => 'welcome/index', // The default route
    '_404_' => 'welcome/404', // The main 404 route
    'welcome/404' => 'welcome/404',
    '(:any)' => 'main/$1',
  • 404 and root don't define a controller/method pair, like in some other frameworks. They define a route. So when no route can be found for the URI request, the 404 definition is used, and put through the route engine.It is caught by your (:any) route, which leads to recursive route parsing.

Howdy, Stranger!

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

In this Discussion