Iis 如何修复从https//www到https//非www版本网站的重定向?

Iis 如何修复从https//www到https//非www版本网站的重定向?,iis,https,url-redirection,Iis,Https,Url Redirection,我上周在iis中添加了ssl,并在我的网站的web.config中配置了重定向301规则 今天我注意到这个版本并没有重定向到我网站的版本,图片和css文件等资源在我网站的两个版本中都可用 我添加到web.config的这些规则正确吗 由于IIS和wordpress,我不得不将资源重定向和Unicode Url添加到web.config 从http重定向到https正在工作 从http//www重定向到正在工作 但是,从https//www重定向到不起作用 我的web.config文件: <

我上周在iis中添加了ssl,并在我的网站的web.config中配置了重定向301规则

今天我注意到这个版本并没有重定向到我网站的版本,图片和css文件等资源在我网站的两个版本中都可用

我添加到web.config的这些规则正确吗

由于IIS和wordpress,我不得不将资源重定向和Unicode Url添加到web.config

从http重定向到https正在工作

从http//www重定向到正在工作

但是,从https//www重定向到不起作用

我的web.config文件:

<rewrite>
<rules>
<rule name="HTTPS" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" 
redirectType="Permanent" />
</rule>
<rule name="Redirect Image to HTTP" stopProcessing="true">
<match url=".*\.(gif|jpg|jpeg|png|css|js|pdf|ttf|woff2|woff|mp4)$" 
ignoreCase="true" />
<action type="Rewrite" url="{R:0}" />
</rule>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
<serverVariables>
<set name="REQUEST_URI" value="{UNENCODED_URL}" replace="true" />
</serverVariables>
</rule>
</rules>


根据您的描述,您的规则似乎没有问题,那么您似乎想了解更改任何https请求是否正确?我在这里做了一个样品。这是规则,我希望它能帮助你

 <rule name="rule1" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTPS}" pattern="^on$" />
                    <add input="{HTTP_HOST}" pattern="www[.](.+)" />
                </conditions>
                <action type="Redirect" url="https://{C:1}/{R:0}" />
            </rule>