To disable Apache from displaying the directory structure list, you only need to remove Indexes from Option.
For example, let's look at the Directory configuration of a directory:
The code is as follows: |
Copy code |
<Directory "D:/Apa/blabla"> Options Indexes FollowSymLinks AllowOverride None Order allow, deny Allow from all </Directory>
|
You only need to remove the Indexes in the red code above to disable Apache from displaying the directory structure. The user will not see the list of files and subdirectories under this directory.
Indexes is used to display the directory structure when no index.html file exists in the directory. If Indexes is removed, Apache will not display the list of directories.
Set and modify the Apache file root directory
Open the http. conf file, find the line starting with DocumentRoot, and
The code is as follows: |
Copy code |
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" |
Change to the new DocumentRoot path. For example, if your new path is C: htdocs, change it
The code is as follows: |
Copy code |
DocumentRoot "C:/htdocs" |
3. Find the following content in the http. conf file:
The code is as follows: |
Copy code |
# This shoshould be changed to whatever you set DocumentRoot .# <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"> |
Change the path in diecloud to the root directory of the new file, for example:
The code is as follows: |
Copy code |
<Directory "C:/htdocs"> |
4. Save the configuration file http. conf.
Don't forget to restart apache.
Set Apache virtual directory
Add the following code to the Apache configuration file http. conf:
The code is as follows: |
Copy code |
Alias/B/"C:/htdocs/blabla /" <Directory "C:/htdocs/blabla"> Options Indexes FollowSymLinks AllowOverride None Order allow, deny Allow from all </Directory> |
Then save the configuration file http. conf.
After modifying the configuration file, restart Apache