【问题标题】:Specific Redirect/Rewrite Rule for web.configweb.config 的特定重定向/重写规则
【发布时间】:2013-01-24 22:41:42
【问题描述】:

有人可以协助制定重定向规则吗?

我想将 URL 中任何出现的“newjersey”替换为“new-jersey”。

任何关于如何通过 web.config 执行此操作的建议都会很棒,因为我需要立即执行此操作。蒂亚!

【问题讨论】:

    标签: iis url-rewriting


    【解决方案1】:

    通过以下方式让它工作:

    <rule name="Redirect {1}/newjersey" stopProcessing="true">
    <match url="^([^/]+)/newjersey$" ignoreCase="false" />
    <conditions trackAllCaptures="true">
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Redirect" url="/{R:1}/new-jersey" appendQueryString="false" />
    

    【讨论】:

      猜你喜欢
      • 2019-08-02
      • 2015-01-26
      • 1970-01-01
      • 2012-05-07
      • 1970-01-01
      • 2012-08-27
      • 1970-01-01
      • 2017-07-25
      • 2020-11-01
      相关资源
      最近更新 更多