1. Home
  2. Knowledge Base
  3. Website
  4. Website Tips
  5. How to prevent directory listing via .htaccess

How to prevent directory listing via .htaccess

By default, if you don’t have an index file in a web accessible folder, when accessed through a browser, its contents will be listed.

To prevent the listing of the folder’s contents on your server, you should add the following line to the .htaccess file

++++
Options -Indexes
++++

The .htaccess file must present in the documnet root of that website.

Related Articles