1
I’m using the Slim Framework managed by Composer and when typing into the URL http://localhost/app
an error arises 404-Not Found, if I type http://localhost/index.php/app
it works.
What have I ever done?
Add
AllowOverride All
in<Directory /home/samper/localhost/www>[...]</Directory>
of/etc/apache2/apache2.conf
and the mistake arose 500-Internal Server Error.I enabled the
RewriteBase /
in/home/samper/localhost/www/vendor/slim/slim/.htaccess
of slim and also in the/home/samper/localhost/www/.htaccess
homeI copied the
.htaccess
of/home/samper/localhost/www/vendor/slim/slim/.htaccess
for/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 (/etc/apache2/apache2.conf):
Note: httpd.conf is not available here
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();
I had the same problem and it was difficult to find the solution rs.
– mauricio caserta
managed to resolve with this post @mauriciocaserta ? :)
– smigol
actually had already solved, but I confirmed here! : D
– mauricio caserta