Recently, I uploaded a Laravel project on the web and I immediately ran into a problem. When I enter the url on a web browser, it shows a list of files of the directory!
After spending some time on Google, I read that the folder structure is actually a security feature of Laravel. The public folder is designed to be the only folder accessible to the public (duh). All other folders (app, database, vendors, etc.) should be inaccessible.
Here’s how I solved this.
I created an .htaccess file on my project’s root folder and added the following code.
After saving the .htaccess file, all requests are now redirected to the project’s public folder.
Let me know through the comments if this helped.