I'm trying to use Macaw router that I downloaded and put the file Macaw.php
in the same folder as index.php
. In index.php
I have this code:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'Macaw.php';
use \NoahBuscher\Macaw\Macaw;
Macaw::get('/hello', function() {
echo 'hello';
});
Macaw::get('/', function() {
echo 'hello';
});
Macaw::dispatch();
and I created a .htaccess file in the same folder putting this code in it:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
When I open the site in browser it shows me "hello" in the main route ('/') but when I go to /hello it show 404 Not Found error.
-I'm using apache2 from the ubuntu repository