Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Default route not working
  • Hi guys, I've upgraded to Fuel RC3 recently and now my default route seems to not be working anymore. I can't say 100% sure that it's caused only by the upgrade, as I've also changed some other things in my application before discovering the broken functionality. I'm using the following code in routes.php:
    <?php
    return array(
     '_root_'  => 'dashboard',  // The default route
     '_404_'   => 'error/404',    // The main 404 route
    );
    

    When visiting [url=http://localhost:8888/public/]http://localhost:8888/public/[/url] the 404 route is being invoked, but visiting [url=http://localhost:8888/public/]http://localhost:8888/public/[/url]dashboard does load the correct controller. In my case dashboard is located in a module located in app/modules/dashboard/classes/controller/dashboard.php Any ideas? Suggestions of how to do some debugging?
  • This don't belong here.
  • Either way, this is exactly how Fuel is configured out of the box, but with the welcome controller instead of your dashboard. I just installed RC3 here, and that works without problems, so it's not RC3 related. What was your previous fuel version? Maybe your controller needs to be updated? Have you activated logging? What do you see in the logs?
  • My previous version was RC2.1 (the previous release candidate). I have logging enabled, but there are no related errors. I just tried to use a 'normal' controller as my default controller (ie not a module controller), to rule out the problem has to do with modules, but then the same bahaviour occurs. I'm working on a local apache (MAMP). Any suggestions of where I could start debugging in the code? I already tried doing some echo-ing in the Core\Route class, but that doesn't really give me more insight.
  • Routes are parsed and processed in the constructor of the Request class, which uses the Router class for the actual work. In the Router class, the find_controller() method is in charge of locating the controller to be loaded.
  • I've done some debugging in the find_controller method of the router class, and it appeared that the wrong segments were passed in $match. In the end I figured out that it was because the base_url in the config array wasn't set properly automatically. Reason: I had used a space in my directory structure. Removing the space (or setting the base_url manually resolved the issue). Not sure if the automatic base_url detection could (or should) be able to handle spaces in the path. I normally wouldn't have used it in a production environment, but on my local machine it slipped through. Anyway, issue resolved now. Thanks for the suggestions for debugging.

Howdy, Stranger!

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

In this Discussion