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
My 000-default.conf ( /etc/apache2/sites-available/000-default.conf ) :
>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();