This seems like it should work but I get a 404 error.
My app looks like this:
lib/init.php:
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/../views',
));
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
and web/index.php:
require_once __DIR__.'/../lib/init.php';
$app->get('/about', function() use ($app) {
return $app['twig']->render('about.twig.html');
})
->bind('about');
$app->get('/', function() use ($app) {
return $app['twig']->render('index.twig.html');
})
->bind('homepage');
$app->run();
I am using MAMP to test on my local machine. When I visit localhost:8888/web it renders the index page fine, no problems, but visiting localhost:8888/web/about gives a 404 error.
What is going on here?
The url is the part after
web/index.php. So/aboutmatchesweb/index.php/about.Now you want to remove that
index.phpbit from the url. You can do this with HTACCESS, read this question to understand how.