【问题标题】:IIS - Redirect http requests from url to another url in the same folderIIS - 将 http 请求从 url 重定向到同一文件夹中的另一个 url
【发布时间】:2019-01-17 19:42:34
【问题描述】:

我有一个 asp 页面作为 IIS8 上托管的 Web 应用程序的一部分。我想设置从该页面到同一站点内另一个 aspx 页面的 http 重定向。难道没有可以在 IIS 中使用的简单设置吗?我看过 http 重定向和 url 重写,但运气不佳。

请求

http://localhost/example.asp 

需要重定向到

http://localhost/example.aspx 

【问题讨论】:

    标签: iis


    【解决方案1】:

    我想通了。我缺少 URL Rewrite 模块。可以下载here。下载后,安装 url rewrite 模块,它将如下所示。打开功能并添加规则。

    添加新规则后,它将显示在 web.config 文件的 system.webserver 标记下,或者您可以直接将其添加到 web.config 文件中。

    <system.webServer>
    <rewrite>
        <rules>
            <rule name="asp_to_aspx" stopProcessing="true">
                <match url="^example.asp$" />
                <action type="Redirect" url="http://localhost/example.aspx" />
            </rule>
        </rules>
    </rewrite>
    </system.webServer>
    

    【讨论】:

      猜你喜欢
      • 2022-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 2023-04-01
      • 2014-05-04
      • 2020-10-01
      相关资源
      最近更新 更多