【发布时间】:2017-10-01 11:45:26
【问题描述】:
我正在尝试在 web.config 中添加重定向规则,以仅以 HTTPS 提供我的网页,而根本不提供 HTTP;到目前为止,我已经使用了这个规则集(连同我的 404 重定向):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
<httpErrors errorMode="Custom" existingResponse="Auto">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="index.php" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>
但是,这会导致 ERR_TOO_MANY_REDIRECTS;这个 web.config 有什么问题导致这个?它似乎适用于其他用户。
我已经尝试过这些帖子中的建议; Redirect loop when forcing HTTPS、URL Rewrite causing redirect loop、this blog 和 this blog。
【问题讨论】:
标签: redirect https web-config