Apache file directory, virtual directory

Source: Internet
Author: User

To Modify a directory:

The default file root directory (documentroot) for Apache HTTP Server is:

DocumentRoot "C:/Program Files/apache Software Foundation/apache2.2/htdocs"

The operations for modifying the Apache file root (documentroot) are as follows:
Open it
C:/Program Files/apache Software foundation/apache2.2/conf/httpd.conf
1. Revise
DocumentRoot "C:/Program Files/apache Software Foundation/apache2.2/htdocs"
For
Umentroot "C:/htdocs"
2.
Modify
# This should is changed to whatever your set DocumentRoot to.
#
<directory "C:/Program files/apache Software Foundation/apache2.2/htdocs" >
For
<directory "C:/htdocs" >

Save httpd.conf, restart Apache


setting up a virtual directory

Suppose your Apache file root directory is:

C:/htdocs

You want to set a virtual directory, alias (alias) is B, the virtual directory path is c:/htdocs/test

You need to add the following code to the Apache configuration file http.conf:

alias/b/"c:/htdocs/test/"

<directory "C:/htdocs/test" >

Options Indexes followsymlinks (remove Indexes will not show Apache directory list)
AllowOverride None
Order Allow,deny
Allow from all
</Directory>

Then save the configuration file http.conf.

After the Apache Service has been restarted, the virtual directory is in effect.

For example, you write a simple test.php file, and then store it in the C:/htdocs/test directory, and then in the browser to the following address to execute the PHP file.

http://localhost:8080/b/test.php

The actual path to the PHP file is:

c:/htdocs/test/test.php






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.