How to disable directory indexing in Apache Server?

dirindex

Many times people asked me how to prevent browsing the files in a folder if there is no index file present in it?.
This is really a must to do thing in any Server. Here we are talking about most used Apache server.

This will be the result if you’ve not done it so far,

 
This is a serious issue if you have not secured your apache server properly!

In Apache server there is an important file called “httpd.conf”.

1. If it is Apache Linux Server this file would be present here => /etc/httpd/conf/httpd.conf
2. If it is Debian then it would be here  => /etc/apache/httpd.conf
3. If you’re using XAMPP then you can find this file at C:xamppapacheconfhttpd.conf

Just open up this file in any good program editor and find the below line

Options Indexes FollowSymLinks Includes ExecCGI

Just remove this word “Indexes” from this line and save the http.conf

Now this line will be like this

Options FollowSymLinks Includes ExecCGI

After you save the file you should Restart the Apache server to make it work. That’s it!

 

Leave a Reply

Theme: Overlay by Kaira
Agurchand