我不知道要很好的理解你的問題。 看來你需要URL重寫規則。
根據這一link
<rule name="CName to URL - Rewrite" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(.*)\.domain\.com$" />
</conditions>
<action type="Rewrite" url="/app/app.html?language={C:1}" />
</rule>
我認爲這是你需要的;)
編輯24/08/2016 如果你不能有一個正則表達式模式dynmique你必須儘可能多的規則,你有子域:
<rule name="finnishRule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(finnishword)\.domain\.com$" />
</conditions>
<action type="Rewrite" url="/app/app.html?language=fi" />
</rule>
<rule name="finnishRule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(otherwordinswedish)\.domain\.com$" />
</conditions>
<action type="Rewrite" url="/app/app.html?language=swe" />
</rule>
或者你可以混合在一起,如果你想重新直接在url上包含單詞「swedish」的所有子域名?
<rule name="finnishRule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(.*swedish.*)\.domain\.com$" />
</conditions>
<action type="Rewrite" url="/app/app.html?language=swe" />
</rule>
因此,所有的正則表達式模式後是給你;)
編輯25/08/2016
也許你需要添加條件跳過靜態文件
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
...
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
您是否嘗試過ARR中的UrlRewrite模塊和/或重寫規則?你沒有描述你目前的做法,這可能意味着你錯過了這兩個明顯的可能性。 –
對不起,忘了補充一點,看我的編輯! – Stuggi