# How do I resolve two domain names to one server?

**URL:** <https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992>\
**Category:** Factual Questions\
**Created:** [March 24, 2005, 2:23am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992 "2005-03-24T02:23:20Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 2:23am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/1 "2005-03-24T02:23:20Z")

</div>

I apologize if my question doesn’t make sense. I think that’s what I mean…

Basically, here’s my problem. I have [www.oldname.net](http://www.oldname.net) that I’ve used for the past three years and people interested in visiting my website would have this bookmarked. However, due to recent developments, I would like to get a new domain name ([www.newname.net](http://www.newname.net)). I would like to host both domain names on the same server, and I would like them to resolve to the same place. So if somebody goes to the bookmark for [oldname.net](http://oldname.net), they will automatically arrive at [newname.net](http://newname.net). Like the big businesses who own both “com” and “net” names and typing in one will automatically take you to the other.

Can anybody help me with this?

---

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 2:25am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/2 "2005-03-24T02:25:01Z")

</div>

I just meant those URLs to be examples. I didn’t realize they would show up as real urls.

---

<div class="post-metadata">

**Author:** ![ShortBus](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@ShortBus](https://boards.straightdope.com/u/ShortBus)\
**Post date:** [March 24, 2005, 2:30am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/3 "2005-03-24T02:30:09Z")

</div>

> [@pepperlandgirl](#):
>
> I apologize if my question doesn’t make sense. I think that’s what I mean…
> 
> Basically, here’s my problem. I have [www.oldname.net](http://www.oldname.net) that I’ve used for the past three years and people interested in visiting my website would have this bookmarked. However, due to recent developments, I would like to get a new domain name ([www.newname.net](http://www.newname.net)). I would like to host both domain names on the same server, and I would like them to resolve to the same place. So if somebody goes to the bookmark for [oldname.net](http://oldname.net), they will automatically arrive at [newname.net](http://newname.net). Like the big businesses who own both “com” and “net” names and typing in one will automatically take you to the other.
> 
> Can anybody help me with this?

The easy way is just to make both domain names resolve to the same IP address. The specifics on how to do this is very heavily dependant on the configuration your hosting company uses. If they’re using host headers, for example, things get a bit more tricky.

You might have to call your hosting company on this one.

---

<div class="post-metadata">

**Author:** ![ShortBus](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@ShortBus](https://boards.straightdope.com/u/ShortBus)\
**Post date:** [March 24, 2005, 2:38am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/4 "2005-03-24T02:38:16Z")

</div>

If you can directly edit your DNS records (most larger hosting companies don’t allow this, but you can sometimes call them and they’ll make the change for you), you can add what’s called a CNAME record in the zone file for oldname that points a visitor to newname. Be careful though, CNAME records can cause unexpected problems, esp. with email.

From ZoneEdit’s FAQ:

> [@](#):
>
> You must be very careful when using CNAMEs! Please read this description carefully, as most people do not realize what CNAMEs actually do!
> 
> A CNAME is not the simple “deliver this A record instead of that one” mechanism that they at first appear to be when most people are first introduced to the concept. In fact, CNAMEs are intended to redirect all DNS based traffic for one domain to another. For this reason, it is a violation of the DNS protocol to have a CNAME and any other DNS record for the same domain name.
> 
> Here’s why. It may seem a bit odd at first that if you have a CNAME redirecting “[here.com](http://here.com)” to “[there.com](http://there.com)”, then that means you can’t have a Mail Server (MX) record defined for “[here.com](http://here.com)” – since that would be another DNS record for the same domain name “[here.com](http://here.com)” which is a violation. This is, in fact, the truth, and is also easily accounted for.
> 
> When an e-mail is sent to “[root@here.com](mailto:root@here.com)”, the e-mail client requests the MX record for “[here.com](http://here.com)”, and gets the CNAME instead. The e-mail client follows the CNAME to “[there.com](http://there.com)”, and asks the DNS server at “[there.com](http://there.com)” for the MX record for “[there.com](http://there.com)”! The e-mail for “[root@here.com](mailto:root@here.com)” is then delivered to the mail server for “[there.com](http://there.com)”, and that server had better be set up to handle e-mail for “[here.com](http://here.com)” or else that e-mail is going to get returned to sender!
> 
> It gets worse. Not all email clients understand this behavior of the DNS, so even if you set it up correctly, your email may get returned anyway! For this reason, if you set up a CNAME for the root of your domain, or if you set up a wildcard CNAME, you may not have any inappropriate MX records defined, and you will not receive technical support for e-mail related problems.
> 
> In addition, if your mail server is called “[mail.anywhere.com](http://mail.anywhere.com)”, then you MUST NOT use a CNAME to define its IP address – you MUST use an A record. Mail clients that send e-mail to “[info@anywhere.com](mailto:info@anywhere.com)” will look for the MX record of “[anywhere.com](http://anywhere.com)”. They will discover that the mail server is called “[mail.anywhere.com](http://mail.anywhere.com)”, and look for an A record. If a CNAME record is returned instead, the mail client will very likely not understand it, and return the e-mail to sender!
> 
> Once again, please read and reread this description until you are very clear what it means. The fact of the matter is that most people who use CNAMEs do not need them at all, and really should have used A records instead.

---

<div class="post-metadata">

**Author:** ![rfgdxm](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@rfgdxm](https://boards.straightdope.com/u/rfgdxm)\
**Post date:** [March 24, 2005, 2:41am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/5 "2005-03-24T02:41:42Z")

</div>

> [@ShortBus](#):
>
> The easy way is just to make both domain names resolve to the same IP address. The specifics on how to do this is very heavily dependant on the configuration your hosting company uses. If they’re using host headers, for example, things get a bit more tricky.
> 
> You might have to call your hosting company on this one.

The other way is to do a 301 redirect from the old domain name to the new. If the OP cares about search engine rankings, I strongly recommend doing so via 301s. Search engines can be fickle. I redirect on my sites all requests of the type [http://domain.com](http://domain.com) to [http://www.domain.com](http://www.domain.com) because not doing that can cause problems with search engines. (For those unaware [http://domain.com](http://domain.com) and [http://www.domain.com](http://www.domain.com) technically are 2 different sites. They need not have the same content.)

---

<div class="post-metadata">

**Author:** ![rfgdxm](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@rfgdxm](https://boards.straightdope.com/u/rfgdxm)\
**Post date:** [March 24, 2005, 2:46am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/6 "2005-03-24T02:46:25Z")

</div>

> [@pepperlandgirl](#):
>
> Like the big businesses who own both “com” and “net” names and typing in one will automatically take you to the other.

I just noticed this part. If THAT is what you want, you MUST use the 301 redirect method.

---

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 2:50am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/7 "2005-03-24T02:50:00Z")

</div>

I’ve heard of 301 directs, but I don’t know how to do it. My capabilities as a webmaster are extremely limited, I’m afraid.

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [March 24, 2005, 2:54am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/8 "2005-03-24T02:54:45Z")

</div>

Your best bet is to just ask your hosting company and/or look for info on their site. I run a small ISP and we have a Windows server and also run our own DNS. So what we’d require is for you to make sure both domains point to our nameserver, we have both in our DNS records, and we just pop a Host Header in there for [domain.com](http://domain.com) and [www.domain.com](http://www.domain.com) ([domain.net](http://domain.net) and [www.domain.net](http://www.domain.net) would already be up there for us.)

This is something our customers can’t do themselves, but we’re more than happy to do it for them when they ask.

Of course, Unix servers and other hosts will be different than us. But still - ask them.

---

<div class="post-metadata">

**Author:** ![rfgdxm](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@rfgdxm](https://boards.straightdope.com/u/rfgdxm)\
**Post date:** [March 24, 2005, 3:04am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/9 "2005-03-24T03:04:24Z")

</div>

> [@pepperlandgirl](#):
>
> I’ve heard of 301 directs, but I don’t know how to do it. My capabilities as a webmaster are extremely limited, I’m afraid.

Is your site on a host running a Unix box or a Windows box? I know little about Windows servers. What ZipperJJ has said indicates it would have to be done by the host. On a Unix server (most servers do run Unix), you would do this yourself by uploading to the old domain a .htacess file with the redirect code. If you are on a Unix box, I can get the proper code for you, and tell you how to do this.

---

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 3:18am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/10 "2005-03-24T03:18:05Z")

</div>

I really don’t know. Fortunately for me, my server host is actually a friend of mine. I didn’t want to bother her if this was something I could do myself, but it looks like I’ll have to shoot her a quick email.

Thanks for the responses, everybody. I appreciate it.

---

<div class="post-metadata">

**Author:** ![rfgdxm](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@rfgdxm](https://boards.straightdope.com/u/rfgdxm)\
**Post date:** [March 24, 2005, 3:21am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/11 "2005-03-24T03:21:41Z")

</div>

> [@pepperlandgirl](#):
>
> I really don’t know. Fortunately for me, my server host is actually a friend of mine. I didn’t want to bother her if this was something I could do myself, but it looks like I’ll have to shoot her a quick email.
> 
> Thanks for the responses, everybody. I appreciate it.

If you care to post the URL of the old site, I can likely find out what the server is running by doing a server header check. You probably don’t have to e-mail the host to find this out.

---

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 3:29am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/12 "2005-03-24T03:29:01Z")

</div>

[www.pepperverse.net](http://www.pepperverse.net)

---

<div class="post-metadata">

**Author:** ![rfgdxm](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@rfgdxm](https://boards.straightdope.com/u/rfgdxm)\
**Post date:** [March 24, 2005, 3:36am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/13 "2005-03-24T03:36:28Z")

</div>

Here are your server headers:

#1 Server Response: [http://www.pepperverse.net](http://www.pepperverse.net)  
HTTP Status Code: HTTP/1.1 200 OK  
Date: Thu, 24 Mar 2005 04:35:21 GMT  
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod\_fastcgi/2.2.10 mod\_jk/1.2.0 mod\_perl/1.24\_01 PHP/4.2.2 FrontPage/5.0.2 mod\_ssl/2.8.12 OpenSSL/0.9.6b  
Last-Modified: Mon, 20 Dec 2004 06:58:56 GMT  
ETag: “4f49b6-19a-41c67830”  
Accept-Ranges: bytes  
Content-Length: 410  
Connection: close  
Content-Type: text/html

That site is on a Unix box, and thus you’ll have to upload a .htaccess file to root with the redirect code. To make sure I have the code right, I am going to ask people who know better than me to make sure. Watch this thread, and I’ll post the exact code and specific instructions on how to do this. It’s trivial. Just open any text editor, cut and paste the code, save it to a file named .htaccess, and upload that to root of the server.

---

<div class="post-metadata">

**Author:** ![pepperlandgirl](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@pepperlandgirl](https://boards.straightdope.com/u/pepperlandgirl)\
**Post date:** [March 24, 2005, 3:55am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/14 "2005-03-24T03:55:57Z")

</div>

Sounds good to me. Thank you 🙂

---

<div class="post-metadata">

**Author:** ![Joools](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@Joools](https://boards.straightdope.com/u/Joools)\
**Post date:** [March 24, 2005, 5:53am UTC](https://boards.straightdope.com/t/how-do-i-resolve-two-domain-names-to-one-server/295992/15 "2005-03-24T05:53:05Z")

</div>

Since it’s apache, then the server administrator can just add the following to the server configuration for your old site:

```auto

Redirect permanent / http://www.newname.net/

```

Apache will serve 301 (“permanent”) redirects for any request for your old site to the equivalent URI on your new site.
