title: Apache htaccess: Block direct access to index.html in a folder
body: <p>I have the following code in my .htaccess</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      # block text, html and php files in the folder from being accessed directly
      RewriteRule ^content/(.*)\.(txt|html|php)$ error [R=301,L]
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d 
      RewriteRule . index.php [L]
  &lt;/IfModule&gt;
  
  # Prevent file browsing
  Options -Indexes
  </code></pre>
  
  <p>To block accessing txt, html, php files in the content folder. It works great and it blocks index.html if access the following URI</p>
  
  <pre><code>mysite.com/content/index.html
  </code></pre>
  
  <p>but it's not blocking the index.html content being displayed if it's omitted from URI like:</p>
  
  <pre><code>mysite.com/content/
  </code></pre>
  
  <p>How to solve this problem? Thank you.</p>