skip to Main Content

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


  1. Check for domains hosting settings like “preferred domain” and 301 redirect to HTTPS:

    plesk https redirect

    If you have no 301 redirect to HTTPS you can just delete this web.config.

    Login or Signup to reply.
  2. 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).

    enter image description here

    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.

    Login or Signup to reply.
  3. <rewrite>
       <rules>
           <clear />
           <rule name="Force WWW and SSL" enabled="true" stopProcessing="true">
             <match url="(.*)" />
             <conditions logicalGrouping="MatchAny">
               <add input="{HTTP_HOST}" pattern="^yourwebsite.com$" negate="true"></add>
               <add input="{HTTPS}" pattern="off" />
             </conditions>
             <action type="Redirect" url="https://yourwebsite.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
           </rule>
         </rules>
         <rewriteMaps>
           <rewriteMap name="MapProtocol">
             <add key="on" value="https" />
             <add key="off" value="http" />
           </rewriteMap>
         </rewriteMaps>
       </rewrite>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search