On 04-Jul-98 Oliver Roßbruch wrote:
> Hi,
>
> a friend of mine has three domain names (www.x.com, www.y.com and
> www.z.com) pointing on one IP- address with one
> virtual server running (www.x.com).
>
> So his Problem is to find out wich domain name a user has choosen in
> order to show him the right page.
A most powerfull way is to use the new feautures included in apache 1.3, the
possibility to define a Virtual Host NameBased.
On my machine (192.168.2.2) i have defined this two virtual host:
"httpd.conf"
...
NameVirtualHost 192.168.2.2
<VirtualHost 192.168.2.2>
# primary vhost
ServerAdmin webmaster@home.first_domain
ServerName home.first_domain
ServerAlias *.first_domain
DocumentRoot /usr/local/apache/share/htdocs
</VirtualHost>
<VirtualHost 192.168.2.2>
DocumentRoot /usr/local/apache/share/home.second_domain
ServerAdmin webmaster@home.second_domain
ServerName home.second_domain
ServerAlias *.second_domain
ServerPath /home.second_domain/
RewriteEngine On
RewriteRule ^(/home\.second_domain/.*) /usr/local/apache/share/$1
</VirtualHost>
So , when you try to connect to home.first_domain the apache server , serve
pages in /usr/local/apache/share/htdocs and when you try to connect
home.second_domain apache serves the pages in
/usr/local/apache/share/home.second_domain.
The ServerPath is needed because 'there are still some clients in use who do
not send the required data for the name-based virtual hosts to work properly.
These clients will always be sent the pages from the primary name-based
virtual host (the first virtual host appearing in the configuration file for
a specific IP address).' (From the Apache 1.3.0 manual)
----------------------------------
Andrea Bettarini - LinII
e-mail andrea <andrea@conmet.it>
----------------------------------
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe@lists.php.net To subscribe to the digest list: php3-digest-subscribe@lists.php.net For help: php3-help@lists.php.net Archive: http://www.tryc.on.ca/php3.html
-- end of forwarded message --
-- ó ÔÅÍ, ÞÔÏ ÎÅ ÐÏÍÅÛÁÅÔ ÎÉËÏÇÄÁ, Kittle