简体   繁体   中英

How to enable directory listing in a virtual host of WAMP Server 3

I am using wamp server 3 in my local machine. Whenever I make a virtual host I have to provide at least one index.php file to access my project directory, without it I am getting an 404 error.

But I also want to access my project directory without providing the index file. I like to see the directory lists when server doesn't find an index file. Like the below image:

在此处输入图片说明

I think the issue is in my httpd-vhost.conf file. Here is the virtual-host configuration of the directory that I want to enable directory listing:

<VirtualHost *:80>
    ServerName virtualhost.info
    DocumentRoot c:/wamp64/www/virtual_host_test
    <Directory  "c:/wamp64/www/virtual_host_test/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Any help would be greatly appreciated.

Found one solution.

By default New Wamp disable the Fancy directory listings.

Edit the C:\\wamp64\\bin\\apache\\apache2.4.17\\conf\\httpd.conf

Need to load this module (remove the #)

LoadModule autoindex_module modules/mod_autoindex.so

Need to load this conf (remove the #)

Include conf/extra/httpd-autoindex.conf

Reference links: WAMP is not displaying the icons in the directory listing

Thanks

Try this...

<VirtualHost *:80>
  ServerName virtualhost.info
  DocumentRoot c:/wamp64/www/virtual_host_test
  <Directory  "c:/wamp64/www/virtual_host_test/">
    Options +Indexes +FollowSymLinks +MultiView
      AllowOverride All
      Require local
   </Directory>
</VirtualHost>

Note the + at the start of the Indexes option. You should also read up on this.

https://wiki.apache.org/httpd/DirectoryListings

If you want to enable directory browsing simply you need to do this under the VirtualHost

Options +Indexes +FollowSymLinks +MultiViews
#Options -Indexes

and for disabling this feature you just reverse :

#Options +Indexes +FollowSymLinks +MultiViews
 Options -Indexes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM