php - How to achieve server access outside the root directory?
怪我咯
怪我咯 2017-05-16 12:58:52
0
1
402

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:

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
Peter_Zhu
/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>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template