It is the first time I play with Silex. I've tried a '/' route, in GET and POST, and all works fine. Now I am trying to make more complex requests:
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$app = new Silex\Application();
$app->get(
'/home',
function () use ($app) {
return 'Homepage';
}
);
$app->run();
"/home" route returns "The requested URL /home was not found on this server.". Why?
This is my .htaccess:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FIOLNAME} !-f
RewriteRule ^ index.php [L]
"/index.php/home" works
Try index.php/home
. If that works you are missing the .htaccess (on Apache).
Take a look here http://silex.sensiolabs.org/doc/web_servers.html
This should do the work :
$ sudo a2enmod rewrite
$ sudo service apache2 restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With