2 domain names -> 1 server -> 2 different websites

Glaanieboy

OSNN Veteran Addict
Joined
6 Mar 2002
Messages
2,628
I am curious. I am using Apache 2 on a Windows XP Pro machine. Currently, I have a dyndns.org account, that redirects glaanieboy.dyndns.org to my home machine. What I want to know, is it possible to create another dyndns account (or any other redirecting service, such as freeddns) and have that domain redirect to the same server, but to another directory? Is this what Virtual Host stands for?
I hope I make sense here, if not, please say so.
 

blinden

OSNN Senior Addict
Joined
4 Aug 2002
Messages
268
I know this is, for me, easier to do under IIS because you can just give one NIC mulitiple IP addresses and then point different domains in to different "IP's" however, this wouldn't work in your situation because I would figure you recieve your IP dynamically from your ISP (Which would explain the DYNDNS stuff you need). Sorry I cannot help you with this, I don't think it's possible because of your internet service.
 

Glaanieboy

OSNN Veteran Addict
Joined
6 Mar 2002
Messages
2,628
Thanks blinden, though I am sure I have seen it somewhere. Somehow Apache must detect from which domain the server was accessed and provide the correct website. Am I right?
 

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
This is what I use on my apache server for name based virtual hosting

NameVirtualHost *

<VirtualHost *>
ServerAdmin admin@domain.com
DocumentRoot /path/to/html/documents/
ServerName second.domain.com
ServerAlias second
<Directory "/path/to/html/documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
 

Glaanieboy

OSNN Veteran Addict
Joined
6 Mar 2002
Messages
2,628
Hmm, didn't work quite like I wanted. As I said, I already had glaanieboy.dyndns.org redirected to my server, but when I added the other dyndns.org account I created as a VH, both domain names would redirect to the second website. So I added both sites as a VH:
Code:
NameVirtualHost *:80

<VirtualHost *:80>
ServerName second.dyndns.org
ServerAlias second
DocumentRoot "C:/path/to/second/site"
</VirtualHost>

<VirtualHost *:80>
ServerName first.dyndns.org
DocumentRoot "C:/path/to/first/site"
</VirtualHost>
And that worked :)
 

Members online

Latest profile posts

Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?

Forum statistics

Threads
62,007
Messages
673,466
Members
5,602
Latest member
evoseeedbox