我已经阅读了很多文章,但没有一篇能解决我的问题 我用 Asp.net 实现了一个 Web 项目,并将 SSL 证书放在我的网站上。一切正常,但是当我输入https://www.forexample.com它时遇到一个错误,说这个连接不是私有的,但如果我输入https://forexample.com,那么它工作得很好。我不知道我应该如何解决它。
这是我在 web.config 中重定向的规则
<rewrite>
<rules>
<rule name="Redirect to non-www" stopProcessing="true">
<match url="(.*)" negate="false"></match>
<action type="Redirect" url="http://forexample.com/{R:1}"></action>
<conditions>
<add input="{HTTP_HOST}" pattern="^forexample\.com$" negate="true"></add>
</conditions>
</rule>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
它在 system.webServer 中。我想我应该找到一种方法将 https\:www 重定向到非 www 我将不胜感激。