Redirect Multiple Domains with Same IP Address

iismultiple-domains

Our company has for many years had multiple domain names to protect our product name. When our webiste was first set up we had all these domain names resolving to on IP address which worked fine until now. We rewrote the site with ASP.NET MVC and now use Recaptcha. The Recaptcha keys are registered to "www.example.com" which is our main domain. We have other domains like "www.examples.com" and "www.ex-ample.com" that points to the same IP address. when someone comes to our site from the alternate domains, Recaptcha doesn't work because the keys aren't registered for that alternate domain. We would like to redirect eveything that comes in from "www.examples.com" to "www.example.com".

I have read that you can set up the sites in IIS and use a permanent redirect, but will this work if the domains all point to the same IP address?

We also have installed the Rewrite Module for IIS 7 because a lot of our pages moved when we switched to MVC. Is it possible to write a rule and if so how?

Is there a better alternative we should be using?

Any help to shine some light on this is greatly appreciated.


I have no problem setting up the domains in IIS, will this work if the domains all point to the same IP address? If I go to www.example.com (192.168.1.1) will it ever end up at www.examples.com (192.168.1.1) which redirects to www.example.com and cause an infinate loop because they are on the same IP address?


How would CNAME be done in a Windows 2003 DNS Server?

Best Solution

For the CNAME approach you need to pick ONE domain name and make that your primary. So make www.example.com the go-to, and every OTHER domain name redirects to this one. Then you can avoid the infinite loop.

There is also a way to setup a configuration on the server so that browsers will allow multiple domains to look at a single cookie, in this case, www.example.com, then when www.examples.com and www.ex-ample.com try to read www.example.com's recaptha session info, it will work. This would allow you to still have multiple url's in the browser, and support shared sessions.

Personally I would just redirect them all to a single domain, MUCH easier to implement.

so do:

127.0.0.1        A       example.com
www.exmaple.com  CNAME   example.com
examples.com     CNAME   example.com
www.examples.com CNAME   example.com

etc.

EDIT: Yes, I was asleep when I wrote this. This is only part of the solution, I posted the remainder of it below.

Related Question