Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Halim's avatar
Level 2

Remove public from URL api Lumen

Hi Laraguys,

Im new in Lumen and Laravel, so i created small api, wich works fine, i run it on my local server with command :

php -S localhost:8000 -t public

Now i would like to host this api some where in shared hosting like Hostgator.., in this case i can't run it with that command. i try on my wamp server after cut index.php and .htaccess from public directory and paste them in the root directory

I change in the index.php file:

$app = require DIR.'/../bootstrap/app.php'; to:

$app = require DIR.'/bootstrap/app.php';

i try to custom my htaccess to, but i get always the error message:

Sorry, the page you are looking for could not be found. NotFoundHttpException in RoutesRequests.php line 596

Please any help

0 likes
3 replies
davorminchorov's avatar

Laravel / Lumen and shared hosting are not exactly best friends. For Laravel / Lumen apps, you need to be able to have full SSH access and complete folder structure control, also known as your own server.

Last time I tried to add a Laravel project on shared hosting, it ended up being way too limited and I was able to add the project files in the public_html folder which ruined the URL paths.

Some shared hostings might allow full SSH access and folder access, but you have to check that in the features they offer.

Please or to participate in this conversation.