I've really been stuggling with this setup. I have purchased three domain names, one from enom and two from cheapnames.
I have one ip address and am running on apache 2.x Xampp version. I have set up the vhosts with named servers. when I run
httpd -S i recieve this setup Please note that "Domainx" has beed substituded for my actual names. for some reason nomatter
which domain name i address to i go to the default web page, uless i do it locally, what am i missing?
httpd -S readout
Setting environment for using XAMPP for Windows.
admin@JEFFERYMORSEMIN C:\xampp
# httpd -S
VirtualHost configuration:
127.0.0.1:80 is a NameVirtualHost
default server Domain1.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:51)
port 80 namevhost Domain1.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:51)
port 80 namevhost Doamin2.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:67)
port 80 namevhost mail1.Domain2.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:86)
port 80 namevhost Domain3.com (C:/xampp/apache/conf/extra/httpd-vhosts.conf:104)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 localhost (C:/xampp/apache/conf/extra/httpd-ssl.conf:80)
Syntax OK
admin@JEFFERYMORSEMIN C:\xampp
In httpd.conf
I have un commented include vhosts.conf
However if i comment out the default within httpd.conf the system doesn't work so i change the default to one of the
vhosts domain3.com and localy if i type in http:\\domainX.com we go to the correct page. but if on the net if i type
in it goes to the default page of www.domain3.com even though it shows the url in the address bar correctly
vhost.conf
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerAdmin postmaster@Domain1.com
DocumentRoot "C:\xampp\www\domain1.com\htdocs"
ServerName domain1.com
ServerAlias www.domain1.com
CustomLog "C:\xampp\www\domain1.com\htdocs\access.log" combined
ErrorLog "C:\xampp\www\domain1.com\htdocs\error.log"
<Directory "C:\xampp\www\domain1.com\htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerAdmin postmaster@domain2.com
DocumentRoot "C:\xampp\www\domain2.com\htdocs"
ServerName domain2.com
ServerAlias www.doamain2.com
CustomLog "C:\xampp\www\domain2.com\htdocs\access.log" #combined
ErrorLog "C:\xampp\www\domain2.com\htdocs\error.log"
<Directory "C:\xampp\www\\domain2.com\htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerAdmin postmaster@mail1.com
DocumentRoot "C:\xampp\www\mail1"
ServerName mail1.maildomain.com
ServerAlias www.mail1.maildomain.com
CustomLog "C:\xampp\www\mail1\access.log" combined
ErrorLog "C:\xampp\www\mail1\error.log"
<Directory "C:\xampp\www\mail1">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerAdmin postmaster@domain3.com
DocumentRoot "C:\xampp\www\domain3.com\htdocs"
ServerName domain3.com
ServerAlias www.domain3.com
CustomLog "C:\xampp\www\domain3.com\htdocs\access.log" #combined
ErrorLog "C:\xampp\www\domain3.com\htdocs\error.log"
<Directory "C:\xampp\www\doamain3.com\htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
my hosts file in system32 xp
127.0.0.1
127.0.0.1 localhost
127.0.0.1 Domain3.com
127.0.0.1 quickstart.localhost #this for Zend local server
127.0.0.1 mail1.maildomain.com
127.0.0.1 domain2.com
127.0.0.1 domain1.com
my .htaccess file which is in the default htdocs folder of the comp which is domain3.com/htdocs
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/domain1.com/
RewriteCond %{HTTP_HOST} ^(www\.)?domain1.com\.
RewriteRule ^(.*)$ domain1.com/$1 [L]
RewriteCond %{REQUEST_URI} !^/domain3.com/
RewriteCond %{HTTP_HOST} ^(www\.)?domain3.com\.
RewriteRule ^(.*)$ domain3.com/$1 [L]
RewriteCond %{REQUEST_URI} !^/domain2.com/
RewriteCond %{HTTP_HOST} ^(www\.)?domain2.com\.
RewriteRule ^(.*)$ domain2.com/$1 [L]