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

Can I upgrade my VPS plan without losing any data or settings?

Yes, you can upgrade your existing VPS to higher plan anytime. Your data will remain intact. We...

Can I open APN port 2195 on my VPS?

You will get full administrative control of your VPS, therefore you can surely open/close any...

How to Install LEMP Stack (Nginx, MariaDB, PHP7.2) on Ubuntu 18.04 LTS?

Nginx, MariaDB and PHP7.2 are called (LEMP). Following are the steps to install LEMP on Ubuntu...

How to Install A-AST Linux Malware Detect Interface in cPanel/WHM?

You can scan your cPanel VPS and dedicated server against malware and keep your environment clean...

How to install Codeignetor centos 7?

Codeignetor is a PHP framework used to build a web application that is used widely by the...