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.