Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should include the host header when checking if HTTPS is enabled and then redirect to the https URL for the appropriate domain.</p> <p>Here's an example:</p> <pre><code>&lt;rewrite&gt; &lt;rules&gt; &lt;clear /&gt; &lt;rule name="Force HTTPS - www.domain1.com" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll"&gt; &lt;add input="{HTTPS}" negate="true" pattern="^ON$" /&gt; &lt;add input="{HTTP_HOST}" pattern="\.domain1\.com$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="https://www.domain1.com{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" /&gt; &lt;/rule&gt; &lt;rule name="Force HTTPS - www.domain2.com" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll"&gt; &lt;add input="{HTTPS}" negate="true" pattern="^ON$" /&gt; &lt;add input="{HTTP_HOST}" pattern="\.domain2\.com$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="https://www.domain2.com{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" /&gt; &lt;/rule&gt; &lt;!-- add more rules for other domains if needed --&gt; &lt;/rule&gt; &lt;/rules&gt; &lt;/rewrite&gt; </code></pre> <p>You can add as many rules for domain names as you want.</p> <p><strong>EDIT:</strong> Sorry, I misread your question. In that case it's even simpler:</p> <pre><code>&lt;rewrite&gt; &lt;rules&gt; &lt;clear /&gt; &lt;rule name="Force HTTPS" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll"&gt; &lt;add input="{HTTPS}" negate="true" pattern="^ON$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" /&gt; &lt;/rule&gt; &lt;/rules&gt; &lt;/rewrite&gt; </code></pre> <p>No need to check for the host header, just include the host name in the redirect. You only have to make sure that you have SSL certificates for all domain names.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload