HostOnNet Blog

Disable or Enable Directory Browsing or Indexing

Looking for Linux Server Admin or WordPress Expert? We can help.

Today a client want to disable directory browsing on his web site. With Directory Browsing or Indexing enabled on your web server, if you don’t upload index.html, web server will show list of all files available in the folder.
 
You can stop directory browsing by two days, the easy way is upload index.html file.
 
Disable Directory Browsing with .htaccess
 
.htaccess file allow you to override some of the server side settings.
 
To disable Directory Browsing, create a file with name .htaccess with following content
 
Options -Indexes
 
If you already have some thing in your .htaccess file, just add this as last line.
 
Enable Directory Browsing
 
To enable directory index or directory browsing, create an .htaccess file with
 
Options +Indexes
 
Directory index will work only if there is no index.html or default document uploaded.
 
Creating .htaccess file on WIndows
 
You may find it difficult to create .htaccess file on Windows, if you try to rename a file to .htaccess, windows will ask you to type file name. To solve the problem, go to command prompt (DOS) and create the file.
 
echo s > .htaccess
 
This will create a file with name .htaccess in the current folder.
 
Now use notepad to edit the file.
 

Posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.