Mike
Mike

Reputation: 1768

Cannot disable Directory Listing in httpd.conf

I just installed XAMPP on my personal CentOS box and when I try to disable Directory Listing I get an Apache error when restarting. My httpd.conf file looks like this after I make the changes:

httpd.conf

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options -Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Error

XAMPP: Starting Apache...fail.
AH00526: Syntax error on line 5 of /opt/lampp/apache2/conf/httpd.conf:
Either all Options must start with + or -, or no Option may.

I have tried removing Indexes all together and I can still see my directories. Maybe I'm in the wrong file, but from what I've read disabling directory listing has to be made here or .htacces (which I am trying to avoid.) In case it comes up I have made sure to restart XAMPP every time I made changes.

Upvotes: 5

Views: 19017

Answers (4)

Niczem Olaske
Niczem Olaske

Reputation: 369

You can also use:

sudo a2dismod autoindex

Upvotes: 0

Om Sao
Om Sao

Reputation: 7663

Please go to file: /opt/lampp/etc/httpd.conf and either comment the line like this:

#Options Indexes FollowSymLinks Includes ExecCGI

or edit like this

Options -Index

For Windows machine: Do same editing in file /apache/conf/httpd.conf

Upvotes: 2

covener
covener

Reputation: 17886

The error message is pretty clear. To rephrase / show examples:

# relative to whatever lower precedence section applies
Options -Indexes

If your goal is to turn off indexes. If you want to make sure FollowSymlinks is also set, put a + in front of it:

# relative to whatever lower precedence section applies
Options -Indexes +FollowSymlinks

If you want to turn everything but FollowSymlinks off:

# not relative
Options FollowSymlinks

Upvotes: 12

edgardcunha
edgardcunha

Reputation: 1

I put a "+" in front of word "FollowSymlinks" to have success. And replace this lines:

AllowOverride All
Order allow,deny

To:

Require all granted

I hope to help you!

Upvotes: 0

Related Questions