Hiding an Apache directory listing
Q I've just set up a new server with my corporate website running on Apache. I have a folder called /var/www/html/downloads with lots of files, which my customers or staff can download through various links in the website If I type www.secretdomain.com/downloads into my browser it gives me a listing of all the files -not necessarily something I want. Is it possible to limit people so that they cannot list the whole directory? I looked at using .htaccess to limit this type of access but I don't particularly want to base access on passwords either.
A The ability to show files in a directory as a series of links is a feature of Apache known as indexes. You can turn this on or off by using the Options tag as follows. Search your httpd.conf file for an Options line which also includes the 'Indexes' statement, for example: Options FollowSymLinks Indexes. Remove the word Indexes, save and restart Apache. This can be set in several places, either for an individual virtual host or globally, so be sure to search for all applicable iterations.
- Apache redirecting
- Fixing Apache virtual host problems
- Configure Apache to have personal websites in home directories
- SSH, mod_rewrite and Apache
- Configuring Apache and NAT