Go to the apache configuration file httpd. conf and find:
The code is as follows: |
Copy code |
Options Indexes FollowSymLinks To: Options FollowSymLinks |
In practice, if indexes does not have index.html, the directory structure is displayed.
The code is as follows: |
Copy code |
1. Prohibit access to some files/Directories Add the Files option to control, for example, do not allow access to Files with the. inc extension, and protect the php class library: <Files ~ ". Inc $"> Order allow, deny Deny from all </Files> Prohibit access to some specified directories: (you can use <DirectoryMatch> for regular expression matching) <Directory ~ "^/Var/www/(. +/) * [0-9] {3}"> Order allow, deny Deny from all </Directory> Prohibit by file matching, for example, prohibit all accesses to images: <FilesMatch .(? I: gif | jpe? G | png) $> Order allow, deny Deny from all </FilesMatch> Prohibit access to the relative URL path: <Location/dir/> Order allow, deny Deny from all </Location> |
Configuration example:
The code is as follows: |
Copy code |
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs"> # # Possible values for the Options directive are "None", "All ", # Or any combination: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named * explicitly * --- "Options All" # Doesn' t give it to you. # # The Options directive is both complicated and important. Please see # Http://httpd.apache.org/docs/2.2/mod/core.html#options # For more information. # This line can be used only to remove indexes. # Options Indexes FollowSymLinks Options FollowSymLinks # # AllowOverride controls what directives may be placed in. htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow, deny Allow from all </Directory> By default, we recommend that you disable APACHE from browsing directory content. |