I got this comment from my "URL Redirection Index" blog entry which I have not totally fleshed out yet. But that is why I called it an "index"! Anyways...

Question:

You know,

Usually "how to's" are articles that show "how to" actually do something. Yours is sort of a let's define the terminology around the "how to" in question.

I've already spent about an hour bumming around the web looking for a redirect in the following simple situation.

I have lots of domain names. My business model calls for just a few (3) websites (the "Big Three") which cover everything I'm interested in. I would like to have it set up so that the cheapo businesscard domains (not the "Big Three") have a "click to enter" spot. That "click to enter" causes their browser to go to one of my "Big Three." When their browser arrives there, I want the local client side html code to note which cheapo businesscard site they came from, and to automatuically redirect them to the appropriate subdirectory. Is that really so difficult ?

I enjoyed your somewhat pompous but thorough layout of the problems of redirection, although it did not seem to cover this possibility. I was told that this was do-able. Is it not do-able on a IIS, even if I wish to buy a solution ? If it is buyable, where or how should I look for this snippet of code ??

thanks,

Answer:

Sometimes, half the battle is agreeing on the right taxonomy to understand what you are trying to accomplish, especially when it comes to "redirection" and people's perceptions of what is actually going on.

Based on your problem description, all you are asking to do is configure Client Side Redirection. Remember, my taxonomy is meant to cover all cases when you boil it down to the essentials. It is obviously not going to spell out every sub-variety.

Since you are only asking for an implementation and not wanting to understand how things work, I will simply spell out one way to accomplish what you are asking. There are others; possibly more optimal, possibly less optimal. But you will have to determine that for yourself.

  1. Register your domain names in DNS and make sure their IP points to a single IIS website.
  2. Configure one IIS website that answers to all your registered domain names. You can do this in one of two ways:
    • This website contains an explicit SiteBindings for every single domain name
    • This website contains a * SiteBinding that answers to any request made to it regardless if it is on your list of domain names or not
  3. This IIS website contains your "click to enter" page, which is an ASP page that can read the Request.ServerVariables( "HTTP_HOST" ) variable value to determine which domain host name was used by the client to arrive at the IIS website and customize the URL link corresponding to "click to enter" to go to the right "Big Three" and hand over the domain host name.
  4. When the user clicks through the "click to enter" URL, that URL link which lives on the "Big Three" websites can then decide to do a 302 Client Side redirection to the appropriate subdirectory. The client will see this subdirectory as the URL in the location/URL bar.

You can of course optimize and merge some of the steps together (for example, steps 3 and 4 can combine into one URL and not even require a redirection), as variations. There are also other ways to do the same thing. One thing that is certain - your description of the implementation steps is impossible to fulfill.

I will leave the actual coding exercise to the reader.

//David