开发者

IIS7 URL Rewrite with dynamic subdomains

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.


for IIS7, url rewrite functionality is built-in. Rules are set in web.config. For IIS6 you need an ISAPI dll that does the same for you. Use IIRF, it works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜