Slim Framework Page Not Found / Apache2

1

I'm using the Slim Framework managed by Composer > and typing in the URL http://localhost/app causes a 404-Not Found error, if I type http://localhost/index.php/app it works.

What have I done?

  • Add AllowOverride All to <Directory /home/samper/localhost/www>[...]</Directory> do /etc/apache2/apache2.conf and the error 500-Internal Server Error .

  • Enabled RewriteBase / in /home/samper/localhost/www/vendor/slim/slim/.htaccess do slim and also in /home/samper/localhost/www/.htaccess of home

  • I copied .htaccess from /home/samper/localhost/www/vendor/slim/slim/.htaccess to /home/samper/localhost/www/vendor/slim/.htaccess

My .htaccess ( /home/samper/localhost/www/.htaccess ) :

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L] 

My apache2.conf :

Note: here you do not have httpd.conf

link

My 000-default.conf ( /etc/apache2/sites-available/000-default.conf ) :

>

link

My PHP:

PHP Version 5.5.9-1ubuntu4.11

My System:

Distributor ID: elementary OS
Description:    elementary OS Freya
Release:    0.3.1
Codename:   freya

My Code:

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'mode' => 'development', //production
    'log.enabled' => false,
    'templates.path' => './view',
));

$app->get('/', function() {
    echo "Home";
});

$app->get('/app', function() {
    echo "App";
});

$app->run();
    
asked by anonymous 17.09.2015 / 23:07

1 answer

2

So even after adding AllowOverride All and restarting apache service apache2 restart it did not work because mod_rewrite is not enabled.

Resolved

sudo a2enmod rewrite && service apache2 restart
    
18.09.2015 / 01:57