0

以下は私のweb.configファイルです。http url から https への自動リダイレクトが必要です。以下を試しましたが、うまくいきません。SSL設定でSSL RequiredがチェックされたIIS7。誰でも助けてください。ありがとう

<configuration>
<configSections>
    <sectionGroup name="system.webServer">
        <sectionGroup name="rewrite">
            <section name="rewriteMaps" overrideModeDefault="Allow" />
            <section name="rules" overrideModeDefault="Allow" />
        </sectionGroup>
    </sectionGroup>
</configSections>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
                <match url="^(.*)$" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTPS}" pattern="off" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>
    <defaultDocument>
        <files>
            <add value="index.asp" />
        </files>
    </defaultDocument>       
</system.webServer>
<system.web>
    <customErrors mode="Off" />     
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>

4

1 に答える 1

1

「SSL が必要」のチェックを外します。リダイレクトを機能させるには、最初に HTTP で最初のリクエストを受け入れる必要があります。

編集

2点目。HTTPS に基づいて入力を選択しています。次のように条件を否定する必要があります。

<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
    <add input="{HTTPS}" pattern="off" negate="true" />
</conditions>
于 2012-04-23T06:58:14.453 に答える