Page 1 of 1

Multiple Sites Problem

PostPosted: 01. August 2010 19:38
by thomas_solutions
I am trying to set up two test sites with XAMPP. So here's what I have done:

1. in the httpd-vhosts file I have added:

<VirtualHost *>
DocumentRoot "E:/Projects/site1"
ServerName site1
<Directory "E:/Projects/site1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *>
DocumentRoot "E:/Projects/site2"
ServerName site2
<Directory "E:/Projects/site2">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

2. I have told to windows (7) with the hosts file that
127.0.0.1 localhost
127.0.0.1 site1
127.0.0.1 site2

THE PROBLEM: when I open with a browser http://site1 or http://site2 both points to the same location: site2. If I change the order in the httpd-vhosts file and I put site2 first, then it will load site1 in both cases. So basically what ever I type (site1 or site2) it points to the location which was specified last in the httpd-vhost file.

Any idea why?

Thanks for your help.

Re: Multiple Sites Problem

PostPosted: 01. August 2010 20:21
by Nobbie
thomas_solutions wrote:Any idea why?


This question has been asked approx. a million times, and the solution is the same as for the other 999999 times. It is always lack of reading documentation and it always lacks the NameVirtualHost Directive.

Why does nobody (including you) read documentation?

Re: Multiple Sites Problem

PostPosted: 02. August 2010 12:49
by thomas_solutions
Thank you... this has sorted out the problem. Unfortunately I have lots of forums, and they all suggested only what I have added to my post.

But anyway, this works perfectly, so thanks again.