How do I enable apache file and directory indexing under Linux or UNIX?
Q. I’m using Apache 2 under Linux. How do I enable apache file and directory indexing? Currently it is disabled and I would like to enable the same for /pdfs/ directory (http://domain.com/pdfs).
A. Under Apache web server automatic index generation is enabled with using Options +Indexes or Options Indexes directive.
If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
Option # 1: Using Apache config file
Add directory option to Apache configuration file /etc/httpd/httpd.conf or /etc/apache2/apache2.conf:
# vi /etc/apache2/apache2.conf
Add following code:
<Directory /var/www/domain.com/pdfs>
Options Indexes FollowSymLinks
</Directory>
Save and close the file. Restart Apache:
# /etc/init.d/httpd restart
OR
# /etc/init.d/apache2 restart
Option #2: Using .htaccess Files with Apache
You can place config line Options Indexes in .htaccess file. Make sure .htaccess file support is enabled.
Change directory to pdfs
$ cd pdfs
Open .htaccess file
$ vi .htaccess
Append following apache directive:
Options Indexes
Save and close the file.
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- Apache Web Server Prevent Directory / Folder Listing
- Forbidden - You don’t have permission to access this page error and solution
- My scripts in cgi-bin directory not working, how do I troubleshoot this problem?
- How do I find the url for my cgi-bin?
- Apache display or change a default page other than index.html
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!




Recent Comments
Yesterday ~ 3 Comments
09/06/2008 11:03 pm (2 days ago) ~ 12 Comments
09/06/2008 02:10 pm (2 days ago) ~ 7 Comments
09/06/2008 06:51 am (2 days ago) ~ 2 Comments
09/06/2008 01:28 am (2 days ago) ~ 3 Comments