5

目前,我的所有域请求都使用以下 URLRewrite 规则定向到 www:

 <rule>
        <name>Canonical Redirect</name>
        <condition name="host" operator="notequal">^test.com</condition>
        <condition name="host" operator="notequal">^$</condition>
        <from>^/(.*)</from>
        <to type="permanent-redirect" last="true">http://www.test.com/$1</to>
    </rule>

我有两个要求:

  1. 我有一个域 child.test.com - 我不希望这个域指向 www.test.com
  2. 我需要这个 child.test.com 指向一个子文件夹,而不在浏览器 URL 中显示它:即键入 child.test.com 实际上应该在后端调用 test.com/child 而不更改浏览器中的 URL。

我相信我可以使用以下代码,但似乎我遗漏了一些东西。感谢所有的帮助!

<rule name="RedirectTo" stopProcessing="true">
       <match url="http://child.test.com" />
       <action type="Redirect" url="http://test.com/child" />
 </rule>
4

0 回答 0