IIRF Rewrite

Topics: Developer Forum, Project Management Forum, User Forum
Dec 2, 2011 at 6:34 PM

Hi all, I have the following need: My IIS hosts many websites (Binding is set to *, the application resolves what to show depending on the domain). The application uses subdomains for each site: x.domain1.com, y.domain2.com, etc.I want to make a rewrite rule so when the user types www.domain1.com/x it is really showing x.domain1.com. I want both x and the domain to be wildcards. I need this rule to apply only if /x is not a file or folder.So if the user writes www.test.com/now what is really showing is what is under now.test.com. This will only apply if www.test.com/now does not really exist.I would appreciate an example of the web.config file.


Dec 6, 2011 at 9:30 PM

Seems to me you do not need a rewrite. If you want to display content for X when your users type in www.domain.com/X, then create a virtual directory, and put the content for X into that virtual directory.

I am not sure how the issue of subdomains is even relevant. If it is, you'll have to explain it in some additional detail.

Keep in mind I am not a mind-reader.  You need to be clear and precise and complete when describing your scenario.  I don't know what you are doing, or how you are configuring, or what your intentions are, unless you describe it explicitly.

Dec 13, 2011 at 5:46 PM

Hi Cheeso, sorry for not being specific. The reason why I dont make a vdir is that my site hosts hundreds of sites. The application shows different features depending on the hostheaders. This done in the application level.


I got the blog to be redirected to the subdomain:

RewriteCond %{HTTP_HOST}   ^www.test.net$  [I]

ProxyPass ^/blog(.*)$ http://blog.test.net/ [U,I,L]


Now I have another challange.  I need to access www.test.com/blog/site2 which exists. I dont know how to tell IIRF not to apply the rule when a page/dir exist. Any suggestions?


Dec 13, 2011 at 7:30 PM

Something else that I found is that the links in each page refer to /blog/test (example), so when you click it, it searches www.test.net/blog/news and I need it to search for the real address which is blog.test.com/news. Is there a way to preserve the original http host when using links?



Dec 14, 2011 at 12:15 PM

Sorry for the posts. I got it figured out. Thanks for your help, I'll let you know if I have any other questions!


p.s. Great product!