【问题标题】:Redirect .aspx url to one without it将.aspx url重定向到一个没有它
【发布时间】:2020-11-28 16:27:36
【问题描述】:

我想使用 IIS 将我的 URL 从带有 .aspx 的旧 URL 重定向到不使用它的 URL。

例子:

  1. https://www.example.com/category.aspxhttps://www.example.com/category
  2. https://www.example.com/category.aspx?type=testhttps://www.example.com/category?type=test

我们可以使用IIS实现上述类型的重定向吗?请帮我解决这个问题。

提前致谢。

【问题讨论】:

    标签: c# asp.net-core iis


    【解决方案1】:

    您可以在 IIS 中使用 URL Rewrite 模块执行此操作。您可以在 IIS 管理器中配置它。 documentation 中有一些示例。此重定向规则应该有效。

    <rewrite>
        <rules>
            <rule name="Redirect from aspx" stopProcessing="true">
                <match url="^(.+?).aspx" />
                <action type="Redirect" url="{R:1}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-19
      相关资源
      最近更新 更多