Pergunta

So i have an existing site running fine in IIS, let's call this domain www.mysite.com. Now there is a folder on the site that is basically a sub-site, that folder is 'foundation'. So I need to point an additional domain at this folder, the additional domain will be www.mysitefoundation.com.

I know how to add domains and such in the Bindings of IIS, but my brain is stuck on how to get a new domain pointing at a particular FOLDER.

I have lots of urlMappings setup, but they don't relate to the new 'foundation' domain. For example I have lots of these:

<add url="~/community" mappedUrl="~/Company/Community"/>

So how do I make it work like this:

Original site www.mysite goes to root/home as usual. While newly added www.mysitefoundation.com goes to what is basically www.mysite.com/foundation?

Clear as mud?! :)

Foi útil?

Solução

You could match using the HTTP_HOST condition

<rule name="RedirectToFoundation" stopProcessing="true">
    <match url=".*" ignoreCase="true" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="mysitefoundation.com" />
    </conditions>
    <action type="Redirect" url="http://www.mysite.com/foundation/{R:0}" redirectType="Permanent" />
</rule>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top