-1

I have problem about setting new project. I just installed wamp 2.2E. I am using windows XP. In folder /www I created folder /example. In WINDOWS/system32/drivers/etc/hosts I added

127.0.0.1       dev.example.com

and in G:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf added at the end

NameVirtualHost dev.example.com:80
<VirtualHost dev.example.com:80>
   DocumentRoot "G:/wamp/www/example"
   ServerName dev.example.com
   ServerAlias dev.example.com

   <Directory "G:/wamp/www/example">
      Options Indexes FollowSymLinks ExecCGI Includes
      AllowOverride All
      Order allow,deny
      Allow from All
   </Directory>
</VirtualHost>

The problem is when I go to dev.example.com/index.php I still get content from www/index.php instead of www/example/index.php. Did I miss anything?

1
  • Maybe this question is better suited to Pro Webmasters?
    – adamjansch
    Aug 21, 2012 at 10:36

3 Answers 3

1

May be you did not restart your apache server after that changes ?

so here is one of my own vhost :

at first you need to add, in the httpd-vhosts.conf, in the beginning of the file :

NameVirtualHost *:80 

then the vhost definition itself :

<VirtualHost *:80>
DocumentRoot "C:/WEB/DOCUMENT_ROOT/www_foxmask/www/"
ServerName foxmask.localhost

<Directory "C:/WEB/DOCUMENT_ROOT/www_foxmask/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

CustomLog "C:\WEB\DOCUMENT_ROOT\apache_logs\www_foxmask.log" common
ErrorLog  "C:\WEB\DOCUMENT_ROOT\apache_logs\www_foxmask-error.log"
</VirtualHost>

nota : in your httpd.conf you should have this line to make the httpd-vhosts.conf works correctly :

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

the path to the file depends on your you installation

hope this could help

2
  • I did. I am not sure if this is windows host problem or apache.
    – user1324762
    Aug 20, 2012 at 14:02
  • I added one example of my own setup with wampserver 2.0
    – FoxMaSk
    Aug 20, 2012 at 19:47
0

The problem was because I missed one step. In the file: G:\wamp\bin\apache\Apache2.2.22\conf\httpd.conf Find: #Include conf/extra/httpd-vhosts.conf and delete the #

3
  • that's what i said in my last comment ....
    – FoxMaSk
    Aug 21, 2012 at 19:50
  • it should be nice if you could accept one answer at least
    – user133014
    Aug 24, 2012 at 22:36
  • You added example after I added this answer. But anyway I just accepted your answer. Aug 27, 2012 at 18:19
0

Try VirtualHost *:80

the DNS Name is taken by ServerAlias as far as i know.

if you have an ServerAlias with only * as wildcard, set your dev.example.com before the * entry.

1
  • I also thought that, but it is not. I removed, restarted this line and still the same. I also copied file from previous installation which worked ok, but still it opend www/index.php instead of www/example/index.php
    – user1324762
    Aug 20, 2012 at 14:05

Not the answer you're looking for? Browse other questions tagged .