Asp.net 使用IIS的特定URL的Http到Https

Asp.net 使用IIS的特定URL的Http到Https,asp.net,ssl,url-rewriting,iis-8,Asp.net,Ssl,Url Rewriting,Iis 8,Net网站。Visual Studio 2013。Windows Server 2012 R2+更新 我试图将一些页面重定向为https,即登录和付款页面以及这些目录下的页面。到目前为止,我已经 <system.webServer> <rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true">

Net网站。Visual Studio 2013。Windows Server 2012 R2+更新

我试图将一些页面重定向为https,即登录和付款页面以及这些目录下的页面。到目前为止,我已经

<system.webServer>
    <rewrite>
        <rules>
            <rule name="Redirect to HTTPS" stopProcessing="true">
                <match url=".*" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                    <add input="{HTTP_HOST}" pattern="^.example\.com$" />
                    <add input="{HttpsRedirects:{REQUEST_URI}}" pattern="(.+)" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{C:1}" appendQueryString="false" redirectType="SeeOther" />
            </rule>
        </rules>
        <rewriteMaps>
            <rewriteMap name="HttpsRedirects">
                <add key="/user/login/" value="/user/login/" />
                <add key="/user/payment/" value="/user/payment/" />
            </rewriteMap>
        </rewriteMaps>
    </rewrite>
</system.webServer>

我已将pattern=“^www.example.com$”更改为pattern=“^.example.com$”,因为该网站的主域名是example.com(不含www)

我的问题是它似乎没有将https添加到这些目录下的所有页面,即登录和支付目录下的所有页面

如果我手动添加https,那么它也会将其应用于图像文件(我看到的图像看起来不正确)


我如何修改上述代码以排除图像(文件扩展名或目录),并确保用户到达这些页面时使用的是https?

为什么不通过https提供所有服务?IMHO,“图像看起来不正确”是需要解决的问题。如果您按照我认为您所说的“排除”图像,那么您将拥有混合的安全和不安全内容-这取决于浏览器,将通知最终用户此类差异,或者更糟的是,甚至不会显示/请求不安全的内容(包括脚本、样式)。该网站已升级并移动到Win Server 2012,我遵循现有结构。完全使用https会损害现有的SEO、链接等吗?我只想为任何传入的HTTP URL添加一个重定向,以将其转换为https URL。我不是搜索引擎优化专家,但我听说HTTPS比HTTP更受欢迎。不管怎样,这对每个人都是好的。这就是我现在所做的。希望没有问题,请随意添加它作为答案,我会接受