3

我想在 IIS 8.5 中创建一个重写规则,以便将 url 中的 TLD 从 .com 更改为 .net。

例子:

来自:http ://sub.domain.com/index.aspx?test=123

至:http ://sub.domain.net/index.aspx?test=123

目前我在 web.config 中得到了类似的东西,但似乎不起作用:

   <rule name="TLD" enabled="false">
       <match url="(.*)" />
       <conditions>
           <add input="{HTTP_HOST}" pattern="^(www.)?([a-z]*.)(domain)(.com)(/?.*)$" />
       </conditions>
       <action type="Rewrite" url="http://{C:2}{C:3}.net/{C:5}" />
   </rule>

有什么建议么?

4

1 回答 1

0

我正在寻找完全相同的问题并发现了这个

 <rule name="WWW" enabled="true" stopProcessing="true">
     <match url=" (.*)"/>
     <conditions >
        <add input="{HTTP_HOST}" pattern="^(www\.)?example\.old$"/>
     </conditions>
     <action type="Redirect" url="h++p://example.com/{R:1}" redirectType="Permanent" />
 </rule>

在这里找到它:重写顶级域(TLD)

于 2019-06-01T18:38:14.163 回答