Modify the root directory/forbidden Directory List/configure virtual hosts in apache

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.