Note that there are some explanatory texts on larger screens.

plurals
  1. POIIS7 URL Rewriting: How not to drop HTTPS protocol from rewritten URL?
    primarykey
    data
    text
    <p>I'm working on a website that uses IIS 7's URL rewriting feature to do a permanent redirect from example.com to www.example.com, as well as rewrites from similar domain names to the "main" one, such as from www.examples.com to www.example.com. </p> <p>This rewrite rule - shown below - has worked well for some time now. However, we recently added HTTPS support and noticed that if users visit one of the URLs to be rewritten to www.example.com then HTTPS is dropped. For instance, if a user visits <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a> they get redirected to <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a>, whereas we would like them to be sent to <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>.</p> <p>Here is the rewrite rule of interest (in Web.config):</p> <pre class="lang-xml prettyprint-override"><code>&lt;rule name="Canonical Host Name" stopProcessing="true"&gt; &lt;match url="(.*)" /&gt; &lt;conditions logicalGrouping="MatchAny"&gt; &lt;add input="{HTTP_HOST}" pattern="^example\.com$" /&gt; &lt;add input="{HTTP_HOST}" pattern="^(www\.)?example\.net$" /&gt; &lt;add input="{HTTP_HOST}" pattern="^(www\.)?example\.info$" /&gt; &lt;add input="{HTTP_HOST}" pattern="^(www\.)?examples\.com$" /&gt; &lt;/conditions&gt; &lt;action type="Redirect" url="http://www.example.com/{R:1}" redirectType="Permanent" /&gt; &lt;/rule&gt; </code></pre> <p>As you can see, the action element's url attribute points directly to http://, so I get why <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a> is redirected to <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a>. My question is, how do I fix this? I tried (naively) to just drop the http:// part from the url attribute, but that didn't work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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