使用 IIS 7.5 的特定页面的 HTTPS URL 重写规则

标签 https url-rewriting iis-7.5

我正在尝试在 IIS 7.5 中重写 URL,以重定向到 HTTPS 以获得“单页”。
域的其余部分应保持 HTTP。

为此,我正在编辑我的 Web.config 文件。有人能告诉我我在做什么吗
以下规则错误:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="SpecificRedirect" stopProcessing="true">
                <match url="^register.aspx$" />
                <action type="Redirect" url="https://mail.domain.org/register.aspx" />
            </rule>
        </rules>
    </rewrite>
  </system.webServer>

下面是我的 URL 重写模块在 IIS 7.5 中的样子

enter image description here

非常感谢。

最佳答案

我认为您非常接近,但是您的重定向会导致无限循环。试试这个:

<rule name="SpecificRedirect" stopProcessing="true">
    <match url="^register.aspx$" />
    <conditions>
        <add input="{HTTPS}" pattern="^off$" />
    </conditions>
    <action type="Redirect" url="https://mail.domain.org/register.aspx" />
</rule>

如果您必须处理多个域,请告诉我,那么规则将需要更复杂的重写 url。

编辑:显然我们需要重定向而不是重写:)

关于使用 IIS 7.5 的特定页面的 HTTPS URL 重写规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13918058/

相关文章:

ssl - 当您在表格中输入数据时,它是加密的吗?

iis-7.5 - ASP.NET 4 返回 500 错误

visual-studio - Visual Studio 11 Beta/IIS 7.5:找不到Microsoft.ReportViewer.Common V11

wordpress - htaccess 将传入链接重写为新链接

iis-7 - Umbraco https 重写规则导致无限循环

delphi - 如何从 IIS ISAPI 的 GetExtensionVersion 中获取我网站的 URL?

http - 将 SSL *仅* 添加到特定文件夹

node.js - 将 LetsEncrypt 与 Node Express 应用程序一起使用

javascript - 针对 Codeigniter 站点上 Javascript 文件通过 http 提供的内容的不安全内容警告

jquery - 如何编辑 jquery 函数