- Code: Select all
Options -Indexes
That’s it, with this line in place, folders which do not contain index files will no longer show the default directory list.
What’s especially nice about doing it this way is all sub-directories of that directory will also get their directory listings turned off. You could then turn on indexes for one of those sub-directories just by making a .htaccess file in that directory with:
- Code: Select all
Options +indexes
If you want the directory contents to be listed, but only if they were HTML pages and not images. Adding the following line to the .htaccess file. IndexIgnore *.gif *.jpg This would return a list of all files not ending in .jpg or .gif, but would still list .txt, .html, etc .