phplaravel-5.1env

.ENV file is visible


I am using Laravel 5.1

I recently uploaded my project in shared hosting. but when i browse http://siteAddress.com/local/.env my .env file is visible.

Is there any way to hide this file or redirect people if they want browse the site with folder view?


Solution

  • Finally I hide .env and disable index view of the folder named local. I create a .htaccess in folder local.

    And here is the code of .htaccess

    # Disable index view
    Options -Indexes
    
    # Hide a specific file
    <Files .env>
        Order allow,deny
        Deny from all
    </Files>