Search code examples
fat-free-framework

The easiest routing in Fat-Free Framework (installed via Composer)


I want to configure the routes for my project via F3. First I installed him via Composer and then I used the instructions about routing engine from This and This.

Then in browser if I'm going to URL localhost/myproject/ it is working fine. But if I'm going to URL localhost/myproject/route1 it isn't working for me and gives 404 server status error. Why?

My code in "index.php":

require_once('vendor/autoload.php');

$f3 = \Base::instance();

$f3->route('GET /', function() {
    echo '123';
});

$f3->route('GET /route1', function() {
    echo '345';
});

$f3->run();

It is the easiest project without anything with only F3. Where I wrong?


Solution

  • make sure you got this .htaccess in your folder and in case that this does not help, comment in the RewriteBase / and adjust the path to match you sub-folder ("myproject").