簡體   English   中英

如何創建web.config URL重寫以將子域重定向到頁面路由

[英]How to create web.config URL Rewrite to redirect a subdomain to a pageroute

我想在像subdomain.domain.com這樣的web.config上創建一個重寫規則到www.domain.com/abc/xyz,並將URL subdomain.domain.com保留在瀏覽器欄中。 我怎樣才能做到這一點? 我嘗試了很多配置,但似乎無法實現。

以下是我嘗試的示例:

<rewrite>
  <rules>
    <rule name="SubDomain" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.domain\.com$" />
      </conditions>
      <action type="Rewrite" url="http://www.domain.com.com/abc/xyz" />
    </rule>
  </rules>
</rewrite>-->

這應該工作:

<rule name="SubDomain" stopProcessing="true">
<match url="(.*)" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="(.*).domain.com" />
    </conditions>
    <action type="Rewrite" url="/abc/xyz" />
</rule>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM