How to Change the www root directory on WampServer

2019-02-04 16:59发布

My need is to change the default sites directory of wamp from say "c:\wamp\www" to say "d:\sites". Right now my projects in "d:\sites" do not show in the project list:

enter image description here

I found a few past answers like this one and this one which I think are not applicable to WampServer 2.5 (anyway, it did not work for me).

I also found this procedure in the documentation, but it seems far too complex for what I need.

Any help on this matter would be appreciated.

5条回答
Melony?
2楼-- · 2019-02-04 17:33
  1. Search the httpd.conf file

enter image description here

  1. Change the DocumentRoot and Path with the one that you want:

enter image description here

  1. Search the httpd-vhosts.conf file

enter image description here

  1. Change the DocumentRoot and Path with the one that you want:

enter image description here

  1. Restart All services

enter image description here

查看更多
Deceive 欺骗
3楼-- · 2019-02-04 17:38

The thing you wanna do is little bit tricky.To do the thing you want just follow following steps:

1 Open file C:\wamp\bin\apache\Apache*.*.*\conf\httpd.conf

2 Find following lines :

DocumentRoot "c:/wamp/www"
<Directory "c:/wamp/www">

3 Modify them to change your root directory /*In my case i want my "C:\" drive as root*/ so i do this :

DocumentRoot "c:/"
<Directory "c:/">

4 Now go to c:\wamp\www find index.php and copy it,and pest into your new root /*In my case i want my "C:\" drive as root*/

5 Now open that index.php and find the following lines:

$wampConfFile = '../wampmanager.conf';
$aliasDir = '../alias/';

6 Now just modify them relative to your root /*In my case i want my "C:\" drive as root*/ so i write:

$wampConfFile = './wamp/wampmanager.conf';
$aliasDir = './wamp/alias/';

Now it will show the default wamp opening page which is shown in the picture!

查看更多
地球回转人心会变
4楼-- · 2019-02-04 17:38

Edit the path in below file then restart wamp server C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf

查看更多
We Are One
5楼-- · 2019-02-04 17:46
  1. Go to apache httpd

    C:\wamp\bin\apache\apache2.2.22\conf

  2. Open httpd

  3. Find DocumentRoot in that file

  4. Change the path

  5. Find the directory tag

  6. Change to Allow from all from Deny from all in Directory tag

    <Directory />
      Options FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
    </Directory>
    
  7. Save & exit

  8. Restart wamp services

查看更多
男人必须洒脱
6楼-- · 2019-02-04 17:48

In newer version of wamp, changing DocumentRoot in httpd.conf did not change DOCUMENT_ROOT. Even after restarting, it stayed as "c:/wamp64/www/".

Instead, the DocumentRoot is set in this file:

  c:\wamp64\bin\apache\apache2.4.18\conf\extra\httpd-vhosts.conf

To change the localhost directory, change these to your path:

      DocumentRoot c:/www
      <Directory  "c:/www/">
查看更多
登录 后发表回答