How do I run it on a local server without calling php -S localhost:8888

I am trying to run slim4 on a local lampp server but I have to use the url: http://localhost/php-sim-4/PHP-SLIM-4-API-WITH-JWT/public/ for it to run, which is incorrect. I would link to run it like this: http://localhost/php-sim-4/PHP-SLIM-4-API-WITH-JWT/ . I tried doing:

 $app->setBasePath('/php-sim-4/PHP-SLIM-4-API-WITH-JWT');

Which is in the docs but it did not make a difference. I also tried setting a .htaccess file in the public folder like this:

# Redirect to front controller
RewriteEngine On
RewriteBase /php-sim-4/PHP-SLIM-4-API-WITH-JWT/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

but this also did nothing. I also tried setting another .htaccess file at the root of the htdocs folder like this:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^$ /php-sim-4/PHP-SLIM-4-API-WITH-JWT/public/     [L]
   RewriteRule (.*) /php-sim-4/PHP-SLIM-4-API-WITH-JWT/public/$1 [L]
</IfModule>

When I do this, I cannot run another site like localhost/another website/. I already spent two days on this. Please help.

I fixed the issue. It turned out I also had another installation of apachie that was installed globally apart from lampp. this was the issue.