如何将子目录重写到子域

时间:2016-04-01 18:11:44

标签: asp.net

我尝试但未能做到:

<rewrite>
  <rules>
    <rule name="blog url rewrite">
      <match url="(.*)$" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="mydomin.com/blog" />
        <add input="{REQUEST_URI}" pattern="^mydomin/blog" />
      </conditions>
      <action type="Rewrite" url="cdn.mydomin.com/{C:1}" />
    </rule>
  </rules>
</rewrite>

任何人都可以帮助我吗?我有asp.net webform应用程序4.5 我想重写:mydomain.com/blog到blog.mydomain.com

1 个答案:

答案 0 :(得分:0)

试试这个:

<rules>
  <rule name="blog url rewrite" stopProcessing="true">
    <match url="blog" />
    <action type="Redirect" url="/blog.{C:1}" />
    <conditions>
      <add input="{REQUEST_URI}" pattern="^/(.*)/blog.*" />
    </conditions>
</rule>