Reputation:
I tried to use the AltoRouter on my webspace in a subfolder. But the matches always false!
I have this structure on my webspace
domain.com
--/2 --> subfolder
----index.php
----.htacces
My .htaccess file looks like this:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /2/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
So I setup up the router like this:
<?php
session_start();
require_once 'vendor/autoload.php';
use LemWebPortal\Config;
$latte = new Latte\Engine;
$router = new AltoRouter();
$router->setBasePath('/2/');
$router->map('GET', '/', function () {
require __DIR__ . '/src/Init/index.php';
});
$router->map('GET', '/schulungsbedarf', function () {
require __DIR__ . '/src/Init/courseRequest.php';
});
$match = $router->match();
if ($match && is_callable($match['target'])) {
call_user_func_array($match['target'], $match['params']);
} else {
// no route was matched
header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
echo '<pre>';
var_dump($match);
Now, when I call domain.com/2/
or domain.com/2/schulungsbedarf
I see an empty white page with this message:
bool(false)
What did I miss here?
Upvotes: 0
Views: 297