I made some projects on laravel with a different version like 5.0, 5.6 My .env file is placed in the root folder and .env code is visible publicly.
I use the below code for hiding the .env file in htaccess
# Hide a specific file
<Files .env>
Order allow,deny
Deny from all
</Files>
above code is working in some domain like myproject.io but not working in project.ai
Please help me Thanks in advance
Did you try with protecting all the dot(.) files?
In nginx
# Block dot files
location ~ /. {
deny all;
}
Apache
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>