Deployed laravel to web-hosting, now ALL my files are accessible in the root directory.
Hello,
I deployed a small project on my shared webhosting and moved the files from public folder to the / root...
Now all my files in the root / are accessible.
for example, I can access composer.json, composer.lock, artisan, package.json, etc... And see all the code inside.
@akc4 I think you are pointing your http://www.example.com to the laravel folder.
You need to point it to the public folder. Once you point to public, there is no need to move any files etc.
laravel <- currently pointing here
├── app
├── public <- point here
├── vendor
...
└── storage
@akc4.htaccess is not reliable because the administrator can misconfigure the server to disable .htaccess and create exposure, but changing the root folder by mistake is less likely.
If your .env is one folder level higher than public (which is Laravel's default), it is considered safe.