0

I want to enable the Directory Index with Apache 2.4 on CentOS 6. First I edited httpd.conf but it didn't work so I ended up with placing a .htaccess file in the desired folder, hoping that no setting could override the .htaccess directives. But it didn't work either, when I request the directory I get a 403.

Here is what I tried so far:

  1. Checked that .htaccess file is working by putting garbage in it

  2. Put those lines in httpd.conf:

    <Directory "/var/www/path/to/folder">
        AllowOverride All
    </Directory>
    
  3. Wrote those lines in .htaccess:

    DirectoryIndex disabled
    Require all granted
    Allow from all
    Options +Indexes
    
  4. Checked if mod_autoindex is enabled

  5. Ran apache2ctl configtest -> Syntax OK

  6. Changed file and directory ownership and group to apache, .htaccess permissions to 666

But nothing works, I just get the fancy "Testing 123.." Apache/CentOS Error page...

After Michael Hamptons comment I added the following step:

  1. Set httpd.conf error level to 'debug'

    -> Nothing is logged in error_log

    -> access_log logs just:

    "GET / HTTP/1.1" 403 4897 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
    AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
    

    ... followed by 4 font requests fo the Error page, which seems to me like I am looking in the wrong file, or the error level setting doesn't work?

1

1 Answer 1

0

I turned out that there is a file named /etc/httpd/conf.d/welcome.conf which has a directive that overrides the one in the .htaccess file:

By commenting this line out I solved my problem:

<LocationMatch "^/+$">
    #Options -Indexes
    ErrorDocument 403 /.noindex.html
</LocationMatch> 

Answer found on Stackoverflow

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .