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


OSNN Veteran Addict
6 Mar 2002
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.
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.
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?
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
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:
NameVirtualHost *:80

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

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

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
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.

Forum statistics

Latest member