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

Glaanieboy

OSNN Veteran Addict
Joined
Mar 6, 2002
Messages
2,626
#1
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
Aug 4, 2002
Messages
268
#2
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
Mar 6, 2002
Messages
2,626
#3
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
Mar 18, 2002
Messages
7,805
#5
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
Mar 6, 2002
Messages
2,626
#7
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

No members online now.

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
62,000
Messages
673,421
Members
89,024
Latest member
swipk8