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

deepness's avatar

Removing public url problem with subfolder installation.

Hi,

I want to remove the public folder from the URL. I have tried to add the following .htaccess to root directory but got 404.

<IfModule mod_rewrite.c>
    RewriteEngine On

  
    RewriteBase /myapp/


    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/  [L]
</IfModule>

I also tried to move public/index.php to root but this way is insecure and assets not working properly.

Any help would be appreciated. Thanks

0 likes
2 replies
siangboon's avatar

https://laravel.com/docs/7.x#configuration

Public Directory

After installing Laravel, you should configure your web server's document / web root to be the public directory. The index.php in this directory serves as the front controller for all HTTP requests entering your application.

deepness's avatar

Thanks for the answer but I'm using lumen and I want to serve this app to multiple people so I don't want to ask them to do some web config file changes. I just want to let .htaccess file to handle this but sure how. would be good for some example.

Please or to participate in this conversation.