Please create a file .htaccess
where you have a .env file, and write the code as shown below:
<Files ~ "^.*\.([Ee][Nn][Vv])">
order allow,deny
deny from all
satisfy all
</Files>
Then try hitting the .env file from the URL and it will not be available and will show the codes inside.
github.
, .gitignore .
.env