0

我有一个托管在 A2 Hosting 上的旧网站,我正在尝试将其重定向到托管在 GoDaddy 上的新域。我尝试在我的 web.config 上编辑“HTTP 到 HTTPS 重定向”规则,但是它仍然没有重定向。

<rewrite>
        <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
            <match url="(.*)" /> 
            <conditions> 
                    <add input="{HTTPS}" pattern="^www.test.gov.mp$" ignoreCase="true" />
            </conditions> 
            <action type="Redirect" redirectType="Permanent" url="https://www.test.health/{R:1}" />
            </rule>   
        </rules>
        </rewrite>

test.gov.mp 是我的旧域,test.health 是我的新域。

4

1 回答 1

0

如果你想重定向www.test.gov.mpwww.test.health,你可以参考这个规则。该模式使用正则表达式来检查{HTTP_HOST}是否等于www.test.gov.mp,操作中的 {R:1} 表示域名本身后面的 URL 中的任何内容。

<rule name="test" stopProcessing="true">
   <match url="(.*)" />
      <conditions>
         <add input="{HTTP_HOST}" pattern="^www.test.gov.mp$" />                 
      </conditions>
   <action type="Redirect" url="http://www.test.health/{R:1}" />
</rule>
于 2022-02-23T02:25:39.793 回答