【问题标题】:Redirect using Special Character %3C使用特殊字符 %3C 重定向
【发布时间】:2020-07-23 19:04:25
【问题描述】:

如何为包含 %3C 的重定向规则编写匹配 url,它是

示例网址:www.test.com/product/product-detail/123-magazine-%3C43K

匹配 url= ^product/product-detail/123-magazine-%3C43K--- 不重定向

【问题讨论】:

  • 不错。感谢您提供非常详细的示例。这很有帮助。非常感谢!
  • 如果您的问题得到解决,那么我请求您将有用的建议标记为答案。这将帮助面临同样问题的其他人。

标签: c# regex redirect iis


【解决方案1】:

您可以尝试以下规则:

<rewrite>
        <rules>
            <rule name="special chr rule" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{UNENCODED_URL}" pattern="^/product/product\-detail/([a-zA-Z0-9%-+].+)" />
                </conditions>
                <action type="Redirect" url="http://www.sample1.com/product/product-detail/{C:1}" />
            </rule>
        </rules>
    </rewrite>

【讨论】:

    【解决方案2】:

    我能够使用 {UNENCODED _URL} 和建议的模式。我认为需要一些正则表达式,但不知道它需要您建议的 [a-zA-Z0-9%-+]。再次感谢。我的链接现在会按原样重定向

    【讨论】:

      猜你喜欢
      • 2013-06-08
      • 1970-01-01
      • 2016-01-28
      • 1970-01-01
      • 2018-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-09
      相关资源
      最近更新 更多