WAMP Integration Environment Change Web root directory

Source: Internet
Author: User

How to change the Web root directory using the Wamp integration environment

Most of the classmates who do PHP development using the WAMP integration environment have had this experience: if you try to modify the Web root, then you will definitely think of modifying the apache/apache2.2.11/conf/ httpd.conf Directory of DocumentRoot, this time if you visit localhost, the site will report 403 error, no access. How should the problem be solved? Take a look at my approach.

After the wampserver is installed, the "www directory" defaults to X:/wamp/www, (where x is the drive letter) and the WWW folder in the Wampserver installation directory. In actual use, the default settings are often not what we want, and may change to other folders more suitable for us, such as e:/xx or d:/php and so on.
The following is an example of changing the original default directory to D:/wamp/www to E:/XX.

1. Open wamp/scripts/config.inc.php

Section - Line,

$wwwDir = $c _installdir. ' /www ';

modified to: $wwwDir = ' e:/xx '; can be.

But now the new problem comes, Apache default root directory has not changed! Keep looking at the 2nd step!

2. Modify the Apache default root directory

Open wamp/bin/apache/apache2.2.11/conf/httpd.conf, modify the value in the double quotation mark after documentroot as you want.

239 Line

like documentroot "d:/wamp/www/"

Change to documentroot "e:/xx/"

At the same time will <directory "d:/wamp/www/" >

Change to <directory "e:/xx/" >

3. Copy the index.php testmysql.php file under the WAMP/WW directory to the new path

Modify index.php

$wampConfFile = '. /wampmanager.conf ';

Revision changed to

$wampConfFile = ' D:/program files/wamp/wampmanager.conf ';

$aliasDir = '. /alias/';

Revision changed to

$aliasDir = ' D:/program files/wamp/alias/';

Then restart Apache to see it.

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.