It is generally recommended to keep sensitive files, such as the .env file, outside of the public_html folder to prevent unauthorized access. If the .env file is located within the public_html folder, it can be accessed by anyone who knows the file path.
To keep sensitive files outside of the public_html folder, you can create a folder outside of public_html and move all Laravel files there except for the public folder. Then, create a symbolic link from public_html to the public folder within the Laravel directory.
Here's an example of how to create a symbolic link using the command line:
ln -s /path/to/laravel/public /path/to/public_html
This will create a symbolic link from the public folder within the Laravel directory to the public_html folder.
By doing this, the sensitive files will be kept outside of the public_html folder and will not be accessible to anyone who visits your website.