Note that there are some explanatory texts on larger screens.

plurals
  1. PORewrite URL iis 7 - https://www.somewhere.com -> https://somewhere.com
    text
    copied!<p>I'm trying to redirect my site from WWW -> root. </p> <p><a href="http://www.example.com" rel="nofollow">http://www.example.com</a> -> <a href="http://example.com" rel="nofollow">http://example.com</a> <a href="https://www.example.com" rel="nofollow">https://www.example.com</a> -> <a href="https://example.com" rel="nofollow">https://example.com</a></p> <p>i've used the following rewrite rules:</p> <pre><code>&lt;rule name="CanonicalHostNameHttp" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false"&gt; &lt;add input="{HTTP_HOST}" pattern="^example\.com$" negate="true" /&gt; &lt;add input="{HTTPS}" pattern="^OFF$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="http://example.com/{R:1}" /&gt; &lt;/rule&gt; &lt;rule name="Redirect to HTTPS" enabled="true" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false"&gt; &lt;add input="{HTTPS}" pattern="^OFF$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /&gt; &lt;/rule&gt; </code></pre> <p>This works fine: </p> <ul> <li>I enter <a href="http://www.example.com" rel="nofollow">http://www.example.com</a>, it redirects to <a href="http://example.com" rel="nofollow">http://example.com</a> </li> <li><a href="http://example.com" rel="nofollow">http://example.com</a> then redirects to <a href="https://example.com" rel="nofollow">https://example.com</a></li> </ul> <p><strong>This fails:</strong> </p> <ul> <li>I enter <strong>https://www.example.com</strong> </li> <li>It never redirects to <a href="https://example.com" rel="nofollow">https://example.com</a> </li> <li>And as a result it gives me a certificate error (because my certificate is for example.com not www.example.com)</li> </ul> <p>What am I missing??? </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