With no .htaccess files and Options FollowSymLinks MultiViews Indexes followed by AllowOverride None in the vhost configuration, I'm getting 404 responses from directory listings. Are there some specific modules I need for directory listings?

My active modules are:

  • authz_host
  • deflate
  • dir
  • env
  • expires
  • headers
  • mime
  • mod-security
  • negotiation
  • php5
  • reqtimeout
  • rewrite
  • setenvif
  • ssl
  • unique_id

VHost Configuration:

<VirtualHost *:443>
    # SSL
    SSLEngine               On
    SSLCertificateKeyFile   /dir/ssl/ssl.key
    SSLCertificateFile      /dir/ssl/ssl.crt
    SSLSessionCacheTimeout  300

<VirtualHost *:80 *:443>
    ServerAdmin     webmaster@localhost
    ServerAlias     domain.tld *.domain.tld
    ServerName      cl.domain.tld

    # Just a few connection resets so that I don't waste my bandwidth on "hackers"
    SecRuleEngine On
    SecRule &REQUEST_HEADERS:User-Agent     "@eq 0"         drop,phase:1
    SecRule REQUEST_HEADERS:User-Agent      "^$"            drop,phase:1

    SecRule REQUEST_LINE                    "://"           drop,phase:1

    SecRule REQUEST_URI                     "^/admin"       drop,phase:1
    SecRule REQUEST_URI                     "^/mail"        drop,phase:1
    SecRule REQUEST_URI                     "^/webmail"     drop,phase:1
    SecRule REQUEST_URI                     \\\\            drop,phase:1

    SecRule REQUEST_METHOD                  !^GET$          chain,drop,phase:1
    SecRule REQUEST_METHOD                  !^HEAD$         chain
    SecRule REQUEST_METHOD                  !^POST$
    <Directory /dir/public_html/>
            Options FollowSymLinks MultiViews Indexes
            Order allow,deny
            allow from all

    DocumentRoot    /dir/public_html
  • can you paste your vhost configuration here ?
    – Raptor
    Jun 3 '13 at 3:49
  • Added the VHost
    – user28412
    Jun 3 '13 at 4:17

Try using this under <Directory>

AllowOverride All

And make sure there isn't a .htaccess file that disables directory browsing in the directory that you're making the request to (and restart Apache).


Make sure that the mod_autoindex module is loaded along with the mod_dir module. Without the former, you'll get an error when browsing directories. See this: Apache Module mod_autoindex

  • That made no difference. I renamed the only .htaccess file I had to be certain.
    – user28412
    Jun 3 '13 at 5:56
  • It was just a shot, copied from an Apache vhost with working directory listing. From what I can see, you have the correct options, unless a .htaccess file is overriding it, which you say isn't the case.
    – dan
    Jun 3 '13 at 6:01
  • Take a look at the first answer here: serverfault.com/questions/232949/…
    – dan
    Jun 3 '13 at 6:22
  • It was worth a shot. Did you only have the modules I have enabled? I think that might be the issue. I also listed my entire VHost configuration. I even did a grep for "options" and saw no "-Indexes" @dan
    – user28412
    Jun 3 '13 at 6:24
  • Hmmm...I take it you can serve files from the directory OK, but just not list them? (Checking the modules I have installed)...
    – dan
    Jun 3 '13 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy