sensorario
sensorario

Reputation: 21620

Why Silex return "The requested URL /home was not found on this server." error message?

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

Upvotes: 4

Views: 7344

Answers (2)

Favian Ioel P
Favian Ioel P

Reputation: 312

This should do the work :

$ sudo a2enmod rewrite
$ sudo service apache2 restart

Upvotes: 4

xmarcos
xmarcos

Reputation: 3368

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

Upvotes: 14

Related Questions