How to Disable Directory Browsing on Website or Blog

Share this Article :

There are two ways to disable or turn off the directory browsing in on your linux server. The main reason for this is to secure your websites and prevent anyone from simply access your installation folders and directories. If the directories or files are exposed to view, this will bring serious security risk.

Follow below steps to disable directory browsing:

1. Turn off directory browsing using httpd.conf:-

–>Open your httpd.conf, vi /etc/httpd/conf/httpd.conf
–>on your Virtual Host and your documentroot setting, find “Options Indexes”
–>Modify exisitng Indexes to -Indexes if any. Else add the Options -Indexes
–>Restart your apache server
–>Finish

Options All -Indexes

2. Turn off directory browsing using .htaccess:-

Also Read :   How to Install Which Command On CentOS

–>Go to your documentroot directory
–>Create or open your existing .htacces file and look for Options Indexes
–>Modify exisitng Indexes to -Indexes if any. Else add the Options -Indexes
–>Finish

Options All -Indexes


Leave a Reply