Page 1 of 1

Name-based virtual hosts in older ver. of XAMPP don't work

PostPosted: 24. January 2013 19:39
by thehawkman
So, i need to run several sites on my laptop (windows 8 ). I also need to run a PHP4 app. I'm not a programmer, so I can't rewrite it. What I am trying to do is create name based virtual hosts in XAMPP 1.4.2 the last version with PHP4. Except I can't get them to work properly.

My setup is like this:


NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

# Win32DisableAcceptEx ON
#

<VirtualHost *>
DocumentRoot c:/xampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost yata4>
DocumentRoot c:/xampp/sites/yata4
ServerName yata4
</VirtualHost>

the problem is now that I added the yata4 virtual host, its contents also gets displayed when typing http://localhost in the address bar.
In case I wasn't clear, if I type in http://yata4 i get the contents of that domain, and if I type in http://localhost I again get the contents of the yata4 subdomain (I checked). This isn't what I expect, (what I had in mind was http://localhost would take to me to xampp/splash.php and typing yata4 would get me the contents of that virtual host. I can't see any issue with my config that would prevent it from working it the way I want it, but something is not working.

Re: Name-based virtual hosts in older ver. of XAMPP don't wo

PostPosted: 29. January 2013 04:53
by JonB
change
Code: Select all
<VirtualHost yata4>


to

Code: Select all
<VirtualHost *>


You probably also need a hosts entry.

127.0.0.1 yata4

Good Luck
:)