-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?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
user1324762
  • 103
  • 2
  • Maybe this question is better suited to [Pro Webmasters](http://webmasters.stackexchange.com/)? –  Aug 21 '12 at 10:36

3 Answers3

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

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.

  • 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 –  Aug 20 '12 at 14:05
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 #

user1324762
  • 103
  • 2