|
| Redirecting Host Headers to specific sub dir in same IIS app? |
 |
Fri, 21 Jul 2006 17:01:01 +000 |
Ok, I've been asked to accomplish somthing kinda strange by the marketing types
in our organization. I won't bore you with the why unless somebody asks.
Here's the 'what' of the situation.
We have a single IIS instance that has three host header names configured to
serve from that IIS instance. Let's say:
http://www.thedomain.com
http://theFirst.theDomain.com
http://theSecond.theDomain.com
What I've been asked to do is always route requests to the HTTP hosts where a
sub domain is present, to a specific sub directory within the IIS instance, but
only when the request is for the HTTP Host and no other sub directory in the URL
.
So it would work like this.
http://theFirst.theDomain.com would be forwarded to
http://theFirst.TheDomain.com/theFirst/
AND
http://theSecond.theDomain.com/ would be forwarded to
http://theSecond.theDomain.com/theSecond/
BUT
http://theFirst.TheDomain.com/somethingElse/ would not be forwarded but rather
allowed to be served normally because it was a specific request for a directory
below the root.
If all requests to the HTTP Host could be forwarded to a specific location, I'd
probably just setup individual IIS instances and autofoward to a second
location, but, in this case I've been asked to only forward to a specific
location if the HTTP Host is a sub domain, and, the URL contains nothing but the
HTTP Host.
Make sense?
Anyone got any ideas?
Thanks!
B
|
| Post Reply
|
| Re: Redirecting Host Headers to specific sub dir in same IIS app? |
 |
Fri, 21 Jul 2006 17:53:41 +000 |
I think the easiest was to do this would be to use a client side redirect in the
HTML header tag or a server side Response.Redirect on the default page for the
site.
|
| Post Reply
|
| Re: Redirecting Host Headers to specific sub dir in same IIS app? |
 |
Fri, 21 Jul 2006 18:09:07 +000 |
Yep, it sure would. I was really trying to over think this one by intercepting
the HTTP request and writing some kind of ISAPI or.... Sometimes the simplest
solution is the best.
Thanks!
B
|
| Post Reply
|
| Re: Redirecting Host Headers to specific sub dir in same IIS app? |
 |
Fri, 21 Jul 2006 18:46:57 +000 |
Exactly! Are you clear on what to do?
|
| Post Reply
|
| Re: Redirecting Host Headers to specific sub dir in same IIS app? |
 |
Fri, 21 Jul 2006 19:10:49 +000 |
Yea, I can take it from here.
You beat me to responding to my own post.
Thanks again for the response.
B
|
| Post Reply
|
|
|
|
|
|
|
|
|
|