How do I enable apache file and directory indexing in Linux or UNIX?

There are 2 ways to enable apache file and directory indexing.

Using Apache config file :

  1. You can add directory options in the Apache configuration file directly. httpd.conf is a apache config file or you can add it in /etc/apache2/apache2.conf:

    # vi /etc/apache2/apache2.conf
<Directory /var/www/example.com/folder>
Options Indexes FollowSymLinks
</Directory>
  1. Once you add the above code, save and close the file.

  2. Restart httpd service.

    # /etc/init.d/httpd restart

Using .htaccess Files with Apache :

If you have .htaccess enabled, you can put a config line options indexes in your .htaccess file.

  1. Open your .htaccess file.

    # vi .htaccess
    
  2. Add the following apache directive.

    Options Indexes
    DirectoryIndex index.php index.html /example.php
  3. Save and close your .htaccess file.
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to Install OpenJDK JAVA 11/8 on Ubuntu?

You can follow this tutorial to install JAVA OpenJDK in all the Ubuntu versions. Following are...

Difference Between su and sudo and How to Configure sudo in Linux VPS.

As we know Linux provides much better security. You can set user management policy and user...

Is HTML5 Supported in Your Servers?

Since HTML content has nothing to do with the web server, there are no special requirements...

Fix :: SSH Error: Starting sshd: Missing privilege separation directory: /var/empty/sshd

Problem Statement Could not connect to Linux machine through SSH. Error Message While starting...

How to Setup MySQL Master-Slave Replication on RHEL 7?

In MySQL Replication process, one server data is automatically copied to another backup server in...