In this article we explain how you can quickly disable web directory browsing for folders on your website. The steps cover disabling directory browsing in cPanel and how to disable indexes via .htaccess.

By default, directory browsing is enabled. This means web visitors will be able to view a list the contents of any directory on your website which does not contain a ‘index’ file. If you prefer, you can disable directory browsing using the steps below:

Steps to disable directory browsing in cPanel

  1. Log in to cPanel
  2. Click Indexes
  3. Navigate to the directory you wish to disable indexes on by clicking the folder icons.
  4. Select the directory by clicking it’s name
  5. Select No Indexing
  6. Click Save

Steps to disable directory browsing via htaccess

  1. Navigate to the folder you wish to disable indexes on
  2. Open the .htaccess file or create a new .htaccess file if it does not already exist in the directory.
  3. Add the following line
    Options -Indexes
  4. Save the .htaccess file