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
- Log in to cPanel
- Click Indexes
- Navigate to the directory you wish to disable indexes on by clicking the folder icons.
- Select the directory by clicking it’s name
- Select No Indexing
- Click Save
Steps to disable directory browsing via htaccess
- Navigate to the folder you wish to disable indexes on
- Open the .htaccess file or create a new .htaccess file if it does not already exist in the directory.
- Add the following line
- Save the .htaccess file