问题
In the past I have worked with my PHP code through vmware, but I recently decided to switch to doing it locally through WAMP (on Windows 8.1).
- I created an empty folder
tests
in thewww
folder. - Then on my browser, I typed
http://localhost/tests
Everything is fine except that the icons icons are not displayed. Here is a picture demonstrating what I mean:
Is there a way to get these icons to display correctly?
回答1:
This has to do with the Apache indexer config file. Its a bug with the Wamp installer. It does not modify the httpd-autoindex.conf configuration file to point to the Wamp directory you specified.
Look in httpd-autoindex.conf and change the paths to point to where the icons are located. On my WampServer, they are located in c:/wamp/bin/apache/apache2.4.9/icons.
Here's the relevant area of httpd-autoindex.conf you need to change:
#Comment out and change below to appropriate icon path
#Alias /icons/ "c:/Apache24/icons/"
Alias /icons/ "c:/wamp/bin/apache/apache2.4.9/icons/"
#Comment out and change below to appropriate icon path
#Directory "c:/Apache24/icons">
<Directory "c:/wamp/bin/apache/apache2.4.9/icons/">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
By default, WampServer should already have enabled the fancy directory listing in httpd.conf. If they are commented out, enable them:
LoadModule autoindex_module modules/mod_autoindex.so
Include conf/extra/httpd-autoindex.conf
Don't forget to reboot Apache after making these changes.
回答2:
I see you are running Apache.
Make sure your config file has an alias to icons as such:
Alias /icons/ "/usr/local/apache/icons/"
回答3:
I had a directory icons/ in my root directory, and could not load anything from icons/. It shows the server icons in place of anything was there.
In C:/xampp/apache/conf/extra directory
, there is httpd-autoindex.conf, this has an Alias.
Alias /icons/ "C:/xampp/apache/icons/"
...and this is the problem.
I had to change it to something else
Alias /iconsZ/ "C:/xampp/apache/icons/"
and I changed all the references from the same file (httpd-autoindex.conf) to reflect the new Alias iconsZ/
来源:https://stackoverflow.com/questions/28131555/wamp-is-not-displaying-the-icons-in-the-directory-listing