The apache directory structure is roughly like this. I specified htdoc as the website root directory.
|-- bin program command directory
|-- build
|-- cgi-bin
|-- conf configuration file directory
|-- error
|-- htdocs Site directory during compilation and installation
|-- icons
|-- include
|-- lib
|-- logs
When I visit localhost, the hodtos folder list is listed by default. There is a small icon of the file type in front of each line, which caught my attention and I looked at the code:
<img src="/icons/folder.gif" />
f12 View http request is http://localhost/icons/folder...
Why can it be accessed across the root directory of the website? Please ask an expert.
ps: I don’t want to ask how to configure the file, I want to ask about the implementation ideas.
Add a picture:
天蓬老师2017-05-16 13:00:52
/etc/httpd/conf.d/autoindex.conf
icons has been aliased (virtual directory)
Alias /icons/ "/usr/share/httpd/icons/"
<Directory "/usr/share/httpd/icons">
Options Indexes MultiViews FollowSymlinks
AllowOverride None
Require all granted
</Directory>