Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

tnx!

share|improve this question
    
Maybe this question is better suited to Pro Webmasters? –  adamjansch Aug 21 '12 at 10:36
add comment

migrated from stackoverflow.com Aug 22 '12 at 6:31

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
I did. I am not sure if this is windows host problem or apache. –  user1324762 Aug 20 '12 at 14:02
    
I added one example of my own setup with wampserver 2.0 –  FoxMaSk Aug 20 '12 at 19:47
add comment

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.

share|improve this answer
    
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 '12 at 14:05
add comment

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 #

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.