I have the following code in my web configuration in order to be able to redirect both URLs with the prefix "www" and non-SSL requests to https://mydomain.com, because the SSL certificate is registered in the domain without www
<rewrite> <rules> <rule name="Remove WWW prefix and redirect to https" > <match url="(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" ignoreCase="true" /> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Permanent" url="https://mydomain.com/{R:1}" /> </rule> </rules> </rewrite>
This is the result:
1) http://mydomain.com/something → https://mydomain.com/something (correct)
2) http://www.mydomain.com/something → https://mydomain.com/something (correct)
3) https://www.mydomain.com/something → Shows a certificate error (there is a problem with this website security certificate.)
If you select "Continue on this site (not recommended)." URL certificate rewritten on page with certificate error (https://mydomain.com/something)
How can I make sure the certificate error is not displayed?
thanks
source share