Page 1 of 1

Directory List

Posted: Mon Mar 14, 2011 4:49 pm
by rasspass
When the default file such as index.html or index.php is missing from the localhost/testsite then all other files within the testsite folder is displayed on the browser. How can I prevent it so it will not show the contents of the directory? Your help is appreciated in advance.

Re: Directory List

Posted: Tue Mar 15, 2011 2:09 am
by cpetercarter
Does your site run on an Apache server? If so, and the server is configured to allow you to use .htaccess files, place an .htaccess file in your root directory with this text:
[syntax]Options -Indexes[/syntax]
or add it to your existing .htaccess file if you have one. Further details here.
Or, simply ensure that you always have an index.html file in every directory. If you have no substantive content to display, you can just display a message, or redirect users to your main site page.