Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Change the www root directory on WampServer 2.5

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.

like image 400
c0der Avatar asked Jul 26 '15 09:07

c0der


People also ask

Where is the www folder in Wamp?

1 Answer. You should put them in /var/www/html which is the location on Linux, on Windows it would go in the WAMP directory.

How do I change my directory in Wamp?

Now we will change the default www directory of WampServer to use a different www directory having all the PHP projects. Click the WampServer tray icon as shown in Fig 2. Now hover over the Apache Option and click the httpd-vhosts. conf Option as shown in Fig 3.

What is the root directory for Wamp directory?

If you installed WAMP to c:\wamp then I believe your webserver root directory would be c:\wamp\www , however this might vary depending on version. Yes, this is where you would put your site files to access them through a browser.


2 Answers

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/">
like image 86
psycho brm Avatar answered Oct 08 '22 14:10

psycho brm


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!

like image 33
g1ji Avatar answered Oct 08 '22 13:10

g1ji