【问题标题】:Remove last character "dash" from url从网址中删除最后一个字符“破折号”
【发布时间】:2015-02-25 11:45:52
【问题描述】:

我正在尝试使用 IIS Rewrite Mod 从我的网站 URL 中删除最后一个“破折号”。

例子:

/serie/fiche/50444/the-fosters-2013- 重定向 301 到 /serie/fiche/50444/the-fosters-2013(没有最后一个破折号)

我已经尝试了一些规则,但没有一个有效:

<rule name="dash problem" stopProcessing="true">
    <match url=".*" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="^addictlive.com([A-Za-z0-9-_/]*)([-])$" />
    </conditions>
    <action type="Redirect" url="http://addictlive.com/{R:0}" />
</rule>

<rule name="dash problem" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="^addictlive.com/([A-Za-z0-9-_/]*)([-])" />
    <action type="Redirect" url="http://addictlive.com/{R:0}" />
</rule>

没有任何作用。

请问有人知道怎么做吗?

【问题讨论】:

    标签: mod-rewrite iis rewrite url-rewrite-module


    【解决方案1】:

    我终于找到了解决办法:

    <rule name="dash problem" stopProcessing="true">
        <match url="(.*)-$" />
        <action type="Redirect" redirectType="Permanent" url="{R:1}" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 2017-08-08
      • 1970-01-01
      • 1970-01-01
      • 2018-07-30
      • 2015-09-11
      • 2011-08-25
      • 1970-01-01
      • 2021-03-18
      • 1970-01-01
      相关资源
      最近更新 更多