Tried Removing Public folder folder url in laravel 9, by moving index.php from public to the root folder.
But i got an error when i removed index.php from public folder to the root folder
Tried Removing Public folder folder url in laravel 9, by moving index.php from public to the root folder.
But i got an error when i removed index.php from public folder to the root folder
The index.php
should stay in the public
folder and you should point your webserver (Apache, Nginx, Caddy, etc.) to serve that file as the entry into the application.
If you were to use the root folder of your Laravel application as the document root (in your webserver) for your application, you expose all files in that folder to the webserver.
For example, you could reach your .env
file at https://yourwebsite.com/.env
. By keeping this in the public folder and using that folder as the document root, the rest of your application is "safe".