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
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
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.