slim framework htaccess 404 not found

I know there are many such questions and I have tried them all but none seems to work.

User directories are configured and so I can open localhost/~h22 (h22 is username)

http://localhost/~h22/slim/index.php/hello/Megh works but http://localhost/~h22/slim/hello/Megh doesnot work giving 404 not found error

Exact error in browser

Not Found

The requested URL /home/h22/public_html/slim/index.php was not found on this server.

.htaccess file is parsed as writing gibberish in the file gives internal server error.

My code is located in

├── composer.json
├── composer.lock
├── .htaccess
├── index.php
└── vendor


require 'vendor/autoload.php';
$app = new SlimSlim();
$app->get('/hello/:name', function ($name) {
    echo "Hello, " . $name;


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


<Directory "/home/h22/public_html/slim">
    AllowOverride All
    Require all granted

Source: apache

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.