How to remove public/index.php from routes in slim framework

Hey I’m using slim framework for my app. my directories are like this app -public --index.php --.htaccess

I’ve registered my routes and if i want to access them i have to call this url:app/public/index.php/myroutes/route

I’ve successfully removed index.php from url so i can access with : app/public/myroutes/route

What I need is to access my route with url:app/myroutes/route I want ro remove the public folder too

NOTE: I don’t want the root directory be changed or move index.php to app folder

<IfModule mod_rewrite.c>
  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^ index.php [QSA,L]
  </IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Hello ,
Could you check your webroot? it must be of the style: …/app/public and not
…/app.

If you use an alias it must also point to public. Warning with Slim4 there is an additional operation for aliases

However, Routes should not be in your public directory. example of Routes declaration in /app/routes.php

$ app-> get (‘/’, function ($ request, $ response, $ args) { echo ‘Hello, world!’; });

When you call http: // localhost / He must answer “Hello World” and not http: // localhost / public / which should return a 404 error