TechGuy
TechGuy

Reputation: 4570

Need to type https:// awlays after adding SSL certificate

I bought a SSL certificate from some company and i have installed it on my Windows 2016 server IIS 10.and it's bind like below image.

When i type https://example.com it works fine... BUT when i type just example.com then it goes to IIS default site. as well as when i type https://www.example.com it works fine but when i type just www.example.com then it goes to Default IIS site.

enter image description here

This means when i type https:// then it works fine... But normally users type example.com or www.example.com .. So how can i configure thisone for the above requirement ?

Upvotes: 0

Views: 32

Answers (2)

Jokies Ding
Jokies Ding

Reputation: 3504

When you type in example.com or www.example.com in web browser, the client will just send a request over http instead of https like http://example.com.

Since you need https for your website so Require SSL will be checked. You can't host both http and https binding under the same site. Otherwise, Require SSL handshake will corrupt URL redirect rule.

enter image description here enter image description here

Please install URL rewrite module and put this rule under your Default Website.

 <rule name="HTTPS force" enabled="true" stopProcessing="true">
 <match url="(.*)" />
 <conditions>
 <add input="{HTTPS}" pattern="^OFF$" />
 </conditions>
 <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
 </rule>

Upvotes: 1

Lex Li
Lex Li

Reputation: 63289

That's exactly what your current site bindings will lead to,

https://docs.jexusmanager.com/tutorials/binding-diagnostics.html#background

So my suggestions are,

  1. Add HTTP bindings back to this, so that http://example.com and http://www.example.com can be handled by this site, not the Default Web Site.
  2. Install URL Rewrite module and then add a rule or rules to redirect HTTP traffic to HTTPS. Tons of articles/posts all over the internet on that.

Upvotes: 1

Related Questions