I think this will work for you, the search template has an optional WWW and redirects using a C: 2 backlink, the rule has a condition for executing only with https.
This is the template:
"^(www\.)?(.*)$"
Where:
{C:0} - www.domain.de {C:1} - www. {C:2} - domain.de
Here is the rule in full:
<rewrite> <rules> <rule name="SecureRedirect" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{HTTPS}" pattern="off" /> <add input="{HTTP_HOST}" pattern="^(www\.)?(.*)$" /> </conditions> <action type="Redirect" url="https://{C:2}" redirectType="Permanent" /> </rule> </rules> </rewrite>
David Martin
source share