2 domains resolve to same virtual host?

digilexic

Verified User
Joined
Nov 5, 2003
Messages
67
I have 2 domain names registered(examples given):

xxxthemovie.com
triplexthemovie.com

I want both of these names to resolve to the same virtual host on my server, can it be done through the DNS panel? (I was thinking an A or CNAME entry)

I didn't want to try anything until I knew if it would work. I don't want to use the DA redirect if it can be helped, as I want the URL to show either name, depending on what was entered.
 
digilexic said:
I have 2 domain names registered(examples given):

xxxthemovie.com
triplexthemovie.com

I want both of these names to resolve to the same virtual host on my server, can it be done through the DNS panel? (I was thinking an A or CNAME entry)
Actually yes; there are two ways. You can do it entirely through the control panel interface if one of them (for example xxxthemovie.com) has it's own IP#.

First set up the site xxxthemovie.com on it's own IP#, upload the site, and make sure it works.

Then remove the site triplexthemovie.com.

Next create (under DNS Admin) a new zone for triplexthemovie.com, with an A record pointing to the same IP# as you've assigned to xxxthemovie.com.

This won't handle any email for triplexthemovie.com; if you want email for triplexthemovie.com to work but forward to the same addresses as you've set up for xxxthemovie.com, you'll need to do a bit more work.
I didn't want to try anything until I knew if it would work. I don't want to use the DA redirect if it can be helped, as I want the URL to show either name, depending on what was entered.
If you need to accept email for the domain, or if you don't have a dedicated IP# for xxxthemovie.com, you'll have to do it differently; this time through the command line:

Set up xxxthemovie.com, as before.

Then set up a domain pointer, pointing triplexthemovie.com, to xxxthemovie.com.

Now, logged in as root:

# /usr/local/directadmin/data/users/username

where username is the name of the user that owns xxxthemovie.com.

Edit httpd.conf as follows:

Find the VirtualHost container with the servername set to triplexthemovie.com, and delete the entire VirtualHost container.

Then find the VirtualHost container for xxxthemovie.com.

Immediately under the line:

ServerAlias www.xxxthemovie.com xxxthemovie.com

create a new ServerAlias line as follows:

ServerAlias www.triplexthemovie.com triplexthemovie.com

Then save your changes and restart httpd as follows:

# service httpd restart

Jeff
 
Back
Top