title: how to write .htaccess and protect sites files and folder in laravel
body: <p>i developed a website in laravel but problem is if someone know the name of files he can directly access that files of website which i don't want</p>
  
  <pre><code>JobScholar
     app 
      Exceptions 
      Http     
      Mail 
      Models   
      Permission.php       
      Providers   -    
      Role.php     
      User.php 
  .env 
    etc etc
  </code></pre>
  
  <p>application is working fine but what i want if user type</p>
  
  <pre><code>http://localhost:8080/JobScholar/app/
  or
  http://localhost:8080/JobScholar/User.php/
  </code></pre>
  
  <p>he should rediret to home controller or see an error message</p>
  
  <p>my .htaccess</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews
          Options -Indexes
          ErrorDocument 403 http://localhost:8080/JobScholar/index
          Options +FollowSymLinks
      &lt;/IfModule&gt;
  
  
      RewriteEngine On
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)/$ /JobScholar/$1 [L,R=301]
  
      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  
      # Handle Authorization Header
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  &lt;/IfModule&gt;
  
  ## Don't listing directory
  #Options -Indexes
  #
  ## Follow symbolic links
  #
  #
  ## Default handler
  #DirectoryIndex index.php
  </code></pre>
  
  <p>i don't want the user to access any of the file or <code>directory</code> the only directory and files he can see are only those whose <code>routes</code> are defines </p>