How to disable viewing of sub-folders on the web



I am curious if I can “lock” all sub-folders of a my url. If someone views my url in a browser, they obviously are directed to the index file which displays my site, but if they enter my url + a sub-directory, they are able to view the directories contents.

Is there a way to disable that, so as to keep data in any sub-folder protected from being viable straight in a browser?



Put the following text in an .htaccess file at the root of your domain:


Andrew! Thanks for getting back to me.

I did a google search about the .htaccess and found this page:

It worked just as I had planned.

Thanks again,


Wow, that page is really old. Use this version instead:


Cool, thanks for the updated link, but I am just going to use the control panel to protect these domains, for the time being. I don’t want to get involved with the access files just yet.

Thanks again!