If you are using apache as your web server, then you would notice that if you type localhost/ in your browser and you fill find the directory listing of your web directory. To stop directory browsing, that is when you type localhost/ in your browse, it redirects to the localhost folder that is the www folder of your server, which will allow everyone to see all the contents of you www directory. To acheive this, just open the httpd.conf file from apache's directory, and find the line,
options indexes followsymlinks
In the above line remove the indexes. This i have tested with wamp server.
options indexes followsymlinks
In the above line remove the indexes. This i have tested with wamp server.