M -
M -

Reputation: 28492

Wamp document root is not updating

Just finished installing WampServer 3.0.4. I want to set it up so when I visit http://localhost/, it serves the files within e:/Archives/, instead of the default WampServer page.

Approach

I found many answers that say I have to open c:/wamp/bin/apache/apache2.4.18/conf/httpd.conf and look for both the DocumentRoot and Directory lines (I found them around line 250). I substituted this:

DocumentRoot "c:/wamp/www"
<Directory "c:/wamp/www/">
    #...
    Options +Indexes +FollowSymLinks
    #...
    AllowOverride all
    #   onlineoffline tag - don't remove
    Require local
</Directory>

with this:

DocumentRoot "e:/Archives/"
<Directory "e:/Archives/">
    #...
    Options +Indexes +FollowSymLinks
    #...
    AllowOverride all
    #   onlineoffline tag - don't remove
    Require local
</Directory>

Notice the only two things updated were the Document Root and Directory paths.

My problem

Now, when I point my browser to http://localhost, it still shows the same default WampServer page in C:\wamp\www\index.php. Clicking on the phpinfo() link shows the following:

DOCUMENT_ROOT  C:/wamp/www
CONTEXT_DOCUMENT_ROOT C:/wamp/www 

... which leads me to believe that my changes to httpd.conf aren't making any difference.

Has anybody ran into this issue? Is there a different way to change the default location that localhost points to? I've tried restarting WampServer, restarting my computer (Running Windows 7), etc.

Upvotes: 1

Views: 4414

Answers (2)

David Robertson
David Robertson

Reputation: 499

Updating httpd.conf DocumentRoot does not work because there is a default virtual host created by WampServer automatically.

This can be found under:

C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf

So either update this or create a second vhost.

Upvotes: 3

jinglebug
jinglebug

Reputation: 131

Possibly try starting a new VirtualHost on localhost.

<VirtualHost localhost:80>
DocumentRoot "E:/Archives"
ServerName localhost
<Directory "E:/Archives">
    Order allow,deny
    Allow from all
    Options Indexes FollowSymLinks
    AllowOverride all
    #   onlineoffline tag - don't remove
    Require all granted
</Directory>
</VirtualHost>

Or, if that isn't the solution for you, and you are absolutely sure you changed any lines regarding C:/wamp/www, then you should try downgrading to WampServer 2. Usually that fixes most Apache problems.

However, this is most likely happening because you didn't change the DocumentRoot at line 230 to DocumentRoot "e:/Archives"

Also, anything above Apache 2.4.9 doesn't work well, so I should downgrade to 2.5. Just so you know.

Upvotes: 3

Related Questions