IIS7 URL Rewrite with dynamic subdomains.

Posted by arri.me on Stack Overflow See other posts from Stack Overflow or by arri.me
Published on 2009-11-22T18:09:45Z Indexed on 2010/05/12 12:24 UTC
Read the original article Hit count: 627

Filed under:
|
|
|

My goal is to implement the following scheme using the subdomain and path as attributes:

Use a wildcard DNS entry that routes any subdomain to the root site: Example:

*.example.com 
ex: http://xyz.example.com 
to
http://example.com

Next I want to rewrite the requests to point to a specific page, passing both the subdomain and the request path as attributes.

Example:

http://xyz123.example.com/images/header.jpg 
to
http://example.com/get.aspx?id=xyz123&path=/images/header.jpg

I've seen several questions on here regarding similar goals, but not quite the same. I'm new to using rewrite rules, so any help is appreciated. I will update this as I make progress.

© Stack Overflow or respective owner

Related posts about iis7

Related posts about url-rewriting