Reputation: 11
Good morning. I have a web application (made with angular if useful) hosted with IIS on a windows server 2016 with certificate (made with Let's Encrypts wacs) that works fine with ssl. the problem is, if i use www the site not only appear as not safe, but also gives 404 error. I tried the following rule on web.config to redirect to non www but without success
<rule name="Redirect WWW to non-WWW" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.com$" negate="true" />
</conditions>
<action type="Redirect" url="https://example.com/{R:1}" />
</rule>
I have other rules, thats my complete webconfig file: https://pastebin.com/wRWarfCV
Upvotes: 0
Views: 680
Reputation: 5195
I think https://www.example.com and https://example.com are Different domains. you need to reissue certificate and add http://example.com as primary domain and add other domain http://www.example.com.
More information you can refer to this link: How do I reissue my SSL certificate?.
Upvotes: 0