15

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.

Community
  • 1
  • 1
c0der
  • 18,467
  • 6
  • 33
  • 65
  • 1
    Just change the path in the configuration file. Then restart the http server process. – arkascha Jul 26 '15 at 10:00
  • 1
    The best way to do this is to create Virtual Hosts. You can have many VHOSTS in one Apache instance, one for each project, and the location of each project can be different and be located almost anywhere. [See this post for how to setup Virtual Hosts](http://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618) – RiggsFolly Jul 26 '15 at 11:18
  • Thanks @RiggsFolly (also for correcting my typo). " Virtual Hosts" is explained in one of the links I posted. I was hoping for something simpler. – c0der Jul 26 '15 at 13:23
  • Its not actually complicated. Once you have the first working its just a copy/paste for every new project – RiggsFolly Jul 26 '15 at 15:34

6 Answers6

36

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/">
psycho brm
  • 7,494
  • 1
  • 43
  • 42
  • And now I have to copy some stuff like wamp languages and wamp themes.... How these guys thought I will change the root? – Andrey Popov Sep 29 '16 at 10:26
8

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!

g1ji
  • 1,099
  • 1
  • 10
  • 21
  • Thanks @G4uKu3_Gaurav. The edit you propose is documented in one of the links I posted. It will indeed make Apache server to start at the desired folder, but it will not show the default wamp opening page which is show in the picture I posted. Copying index.php from the default www folder to the desired folder, did not solve it. – c0der Jul 26 '15 at 10:44
  • @Ofer Yuval I hava modified my Answer and it's doing the thing you wanna do! – g1ji Jul 26 '15 at 13:55
  • Thanks @G4uKu3_Gaurav. It is very similar to what I was trying to do, but something is not working. The new index.php has $server_dir = "../"; AND $aliasDir = $server_dir.'alias/'; AND $wampConfFile = $server_dir.'wampmanager.conf'; so I treid to change server_dir to the new folder : $server_dir = "D:/Program Files/wamp/"; but WAMP icon remains yellow, and running localhost comes up with "This webpage is not available" – c0der Jul 27 '15 at 13:01
  • I am using craft cms and there already is an index.php file where I want to point the www folder of wamp...what do i do? – Radmation Aug 18 '16 at 01:31
7
  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

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Pablo Salazar
  • 800
  • 10
  • 17
3

The best thing about the apache is that it will tell you where it gets an error while trying to load configuration files. on WampServer 3.2.0, I had to make change to few files.

  1. Change it in your virtual hosts file
    {installDirectory}\bin\apache\apache2.4.41\conf\extra\httpd-vhosts.conf ServerName localhost DocumentRoot "D:\Projects\ApacheWWW" <Directory "D:\Projects\ApacheWWW/">

  2. Change it in your index.php from www folder

    $server_dir = "C:/wamp64/";

  3. In scripts/config.inc.php line 13
    $configurationFile = 'C:/wamp64/wampmanager.conf';

Solomon Tesfaye
  • 186
  • 2
  • 10
0
  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

Community
  • 1
  • 1
pvrforpranavvr
  • 2,708
  • 2
  • 24
  • 34
-1

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

ajs
  • 1