正在windows主机上将旧域重定向到新域



我有一个在A2主机上托管的旧网站,我正试图将其重定向到我在GoDaddy上托管的新域。我试过编辑";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是我的新域名。

如果要将www.test.gov.mp重定向到www.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>

最新更新