【问题标题】:How to redirect old directory to new one on IIS如何将旧目录重定向到 IIS 上的新目录
【发布时间】:2012-04-10 12:08:06
【问题描述】:

我想将旧目录重定向到新目录(301 重定向)。就我而言,我想要这个:

为此,我使用 IIS 上的 URL 重写模块来执行此操作。这是我在 web.config 中的规则:

<rule name="test" stopProcessing="true">
                <match url="xxxx" />
                <action type="Redirect" url="yyyy{R:0}" appendQueryString="true" />
            </rule>

它适用于 http://www.mydomain.com/xxxx/1-my-product-namehttp://www.mydomain.com/xxxx/c/my-category-name 但当我转到 http://www.mydomain.com/xxxx/ 时,它会重定向到 http://www.mydomain.com/yyyy// 并带有两个斜线。有谁知道如何避免这种情况?

提前致谢!

【问题讨论】:

    标签: iis redirect http-status-code-301


    【解决方案1】:

    我发现,这是我使用的规则:

    <rule name="tpepme" stopProcessing="true">
          <match url="xxxx(.*)" />
          <action type="Redirect" url="yyyy{R:1}" appendQueryString="true" />
        </rule>
    

    【讨论】:

      猜你喜欢
      • 2014-10-25
      • 1970-01-01
      • 2020-10-31
      • 2017-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-21
      • 2015-05-30
      相关资源
      最近更新 更多