Slim 4 - Error throw HttpNotFoundException in skeleton and manual

hi.
im install slim 4 from composer (skelleton and manual) and every time get this error

Uncaught Slim\Exception\HttpNotFoundException: Not found. in /var/www/html/s5/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:93\nStack trace:\n#0 /var/www/html/s5/vendor/slim/slim/Slim/Routing/RouteRunner.php(72): Slim\Middleware\RoutingMiddleware->performRouting(Object(Slim\Psr7\Request))\n#1 /var/www/html/s5/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\RouteRunner->handle(Object(Slim\Psr7\Request))\n#2 /var/www/html/s5/vendor/slim/slim/Slim/App.php(211): Slim\MiddlewareDispatcher->handle(Object(Slim\Psr7\Request))\n#3 /var/www/html/s5/vendor/slim/slim/Slim/App.php(195): Slim\App->handle(Object(Slim\Psr7\Request))\n#4 /var/www/html/s5/public/index.php(16): Slim\App->run()\n#5 {main}\n thrown in /var/www/html/s5/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php on line 93

“s5” is my project
.htaccess:
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]

index.php:

<?php use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $app->run(); if i put a function get the message is the same sorry for my english please "asap" Linux 4.15.0-74-generic #84-Ubuntu x86_64 x86_64 x86_64 GNU/Linux PHP 7.2.24-0ubuntu0.18.04.2
1 Like

Do you have a second .htaccess file in the public/ directory?

# Redirect to front controller
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
1 Like

Yes, the strangest thing is that I have tried it on several computers and the same error appears in all of them.
I have also tested with different versions of php, 7.0,7.1,7.2
Both in template and with “composer require” from a new project.

Thanks, I have been looking for the answer to this for ages. I had exactly that problem

1 Like