Slim Framework Page Not Found / Apache2

Asked

Viewed 691 times

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 home

  • I 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

http://pastebin.com/C1qFkJ6k

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

http://pastebin.com/drPwFUSS

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();

2 answers

2

So even after adding the AllowOverride All and restart the apache service apache2 restart did not work due to the mod_rewrite is not enabled.

Solved

sudo a2enmod rewrite && service apache2 restart
  • I had the same problem and it was difficult to find the solution rs.

  • managed to resolve with this post @mauriciocaserta ? :)

  • actually had already solved, but I confirmed here! : D

-2

I had the same problem, it also solved for me.

sudo a2enmod rewrite && service apache2 Restart

Browser other questions tagged

You are not signed in. Login or sign up in order to post.