So currently my main domain works fine, if I go to www.domain.com it redirects to https://domain.com
my sub-domains are the issue. I have a wildcard SSL as well for *.domain.com
if I go to www.sub.domain.com, it redirects to https://www.sub.domain.com which has an invalid SSL cert and I am trying to get it to load FROM: www.sub.domain.com to https://sub.domain.com but am having some issues. Godaddy was no help as it seems most of them are “New”. Hosting with Plesk unfortunately. Currently what I have for my web.config is:
<configuration>
<system.webServer>
<rewrite>
<rules>
<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>
</configuration>
3
Answers
Check for domains hosting settings like “preferred domain” and 301 redirect to HTTPS:
If you have no 301 redirect to HTTPS you can just delete this web.config.
Wildcard SSL Certificate cannot work on second level sub-domain when you have installed certificate for first level (for example: level3.level2.level1.domain.com).
You cannot use WWW before your sub-domain. I suggest you to refer my previous answer on the same issue.
https://stackoverflow.com/a/37959152/4649681
Hope this will help.