1

On my WAMP local Host I am running two different social engine websites, in my hosts file I added two lines:

127.0.0.1 site1.com

127.0.0.1 site2.com

in my apache.conf file I have added this code for virtual hosting

<VirtualHost 127.0.0.1>
    ServerAdmin [email protected]
    DocumentRoot /wamp/www/se3
    ServerName site1.com
    ServerAlias site1.com
    ErrorLog logs/site1-error_log
    CustomLog logs/site1-access_log common
</VirtualHost>
<VirtualHost 127.0.0.1>
    ServerAdmin [email protected]
    DocumentRoot /wamp/www/site2
    ServerName site2.com
    ServerAlias site2.com
    ErrorLog logs/site2-error_log
    CustomLog logs/site2-access_log common
</VirtualHost>

Now the problem which I am facing is, when on browser when I type site1.com it loads site1 correctly, but when I type site2.com it loads site1.

I can't find out the actual problem behind this.

Can any one help me out?

:)

1 Answer 1

2

Have you got name based virtual hosting enabled with a NameVirtualHost directive somewhere?

eg: NameVirtualHost 127.0.0.1

2
  • in httpd.conf file their is no where written such line, should I add it? Apr 7, 2011 at 13:34
  • Yes, otherwise Apache will default to IP based virtual hosting where each virtual host will need to be on a separate IP address.
    – James Yale
    Apr 7, 2011 at 13:39

You must log in to answer this question.

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