title: How to protect .env file in Laravel
body: <p>I moved my project to HOST but I can still access .env with address mysite.com/.env and display this file with all variables and secure data.
  my .env file :</p>
  
  <pre><code>APP_ENV=local
  APP_DEBUG=true
  APP_KEY=base64:xxxxxxx
  APP_URL=http://localhost
  
  DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=xx
  DB_USERNAME=xx
  DB_PASSWORD=secret
  
  CACHE_DRIVER=file
  SESSION_DRIVER=file
  QUEUE_DRIVER=sync
  
  REDIS_HOST=127.0.0.1
  REDIS_PASSWORD=null
  REDIS_PORT=6379
  
  MAIL_DRIVER=smtp
  MAIL_HOST=mailtrap.io
  MAIL_PORT=2525
  MAIL_USERNAME=null
  MAIL_PASSWORD=null
  MAIL_ENCRYPTION=null
  </code></pre>
  
  <p>How I can protect this file? And this is the logical solution?</p>
  
  <p>note : (I move all files public folder in root directory.)</p>