我已经创建了ASP.NET Core项目,并为我的网站购买了SSL。我在我的web.config中创建了一个重定向规则,将我的http重定向到https。我的问题是,我的网站上的每个链接现在都有https,这是由于某些链接没有ssl导致证书问题。这是我所做的:IIS将http重定向到https仅适用于域
<rewrite>
<rules>
<rule name="Redirect to https">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="Off" />
<add input="{REQUEST_METHOD}" pattern="^get$|^head$" />
<add input="{HTTP_HOST}" negate="true" pattern="localhost" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
例如,我的网站域名是www.example.com。在我的项目上启用SSL后,我的网站现在是https://www.example.com。我的网站上有我的合作伙伴链接,如www.partner1.com。问题是,现在我的合作伙伴链接也在他们的网址https,但他们的网站没有SSL证书,这意味着当我点击他们的链接,我被重定向到一个https url,因此我有一个证书错误页面。
如何设置我的域名只有https,并让我的合作伙伴的href链接仍然使用http?因为我用同样的我已经与你的情况下检查它的工作perfect..as你在答复中提到
<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>
</rewrite>
:
嗨请检查这个:https://finalcodingtutorials.blogspot.ae/2017/03/non-www-to-www-with-http-to-https.html –
@Usman已经检查这一个,这doesn解决我的问题,我网站上的每个链接仍然保持https .. – Huby03
PLZ分享您的网站链接。 –