When you are pointed to a directory on your web site through direct url which does not have an index file, Files in that directory can be listed on a web page. We can prevent the same with snippets of codes using htaccess. Preventing directory listings can be very useful. For example, you have a directory containing important ‘.zip’ archive files or to prevent viewing of your image directories. Alternatively it can also be useful to enable directory listings if they are not available on your server, for example if you wish to display directory listings of your important ‘.zip’ files. Here goes the Code in Htaccess…
Create a .htaccess file following the main instructions and guidance which includes the following text
IndexIgnore *
Above code which prevents the all directory listings with the folder(Server)
To prevent listing ‘.zip’ files, create a .htaccess file following the main instructions and guidance which includes the following text:
IndexIgnore *.zip
To prevent listing multiple file types, create a .htaccess file following the main instructions and guidance which includes the following text:
IndexIgnore *.zip *.jpg *.gif
Alternatively, if your server does not allow directory listings and you would like to enable them, create a .htaccess file following the main instructions and guidance
which includes the following text:
Options +Indexes
If you are not limited to htaccess you can do the same using httpd.conf.
Disable directory listing using httpd.conf :-
1) Open your httpd.conf, normally it
Latest posts by Reji Kumar R (see all)
- NOKIA ASHA 501 launched - May 14, 2013
- Wammy Desire Tab and Zync Tab - May 9, 2013
- How to protect your wordpress admin (wp-admin) using htaccess - May 8, 2013
Related Posts
Tags: htaccess






