【问题标题】:IIS 8.5 URL rewrite change TLDIIS 8.5 URL 重写更改 TLD
【发布时间】:2019-06-02 11:49:25
【问题描述】:

我想在 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>

有什么建议吗?

【问题讨论】:

  • 我也试过这样做,我肯定浪费了至少一个小时。我不认为这是可能的 - 它不可能像这样动态。

标签: iis url-rewriting iis-8.5


【解决方案1】:

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

 <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>

在这里找到它:ReWrite top-level domain (TLD)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-28
    • 2016-01-09
    • 1970-01-01
    • 1970-01-01
    • 2011-03-01
    • 2016-07-30
    • 2017-07-29
    • 1970-01-01
    相关资源
    最近更新 更多