Reputation: 31778
I have multiple websites hosted on the same server with structure as follows:
http://primary-domain.com/hostedsites/MVCWebApplication1/ = http://MVCWebApplication1.com/
http://primary-domain.com/hostedsites/MVCWebApplication2/ = http://MVCWebApplication2.com/
...
The problem is, all ~/
references made in a hosted site (i.e. MVCWebApplication1, MVCWebApplication2, etc) resolve to
http://MVCWebApplication1.com/hostedsites/MVCWebApplication1/
and not
Please note:
I already have the following my web.config:
<rule name="Remove Virtual Directory">
<match url=".*" />
<action type="Rewrite" url="{R:0}" />
</rule>
How can I fix this?
Upvotes: 1
Views: 723
Reputation: 4300
You just need to convert your virtual directories to applications in IIS.
Upvotes: 0
Reputation: 31778
What I ended up doing was using a bunch of work arounds:
In web.config
:
<rewrite>
<rules>
<rule name="Remove Virtual Directory">
<match url=".*" />
<action type="Rewrite" url="{R:0}" />
</rule>
</rules>
</rewrite>
And instead of creating links like this:
<a href="~/Help">Help</a>
doing this:
@Html.ActionLink("Help", "Help") // This seems to create clean urls
Upvotes: 1