Redirect http to https for multiple wordpress blogs running under IIS -


as title stated, i've wordpress multisite installation running several blogs under iis. need force redirect "http" "https" of them. blogs typically reachable , without 'www'. let's have following blogs:

  • mickey.it
  • donald.it
  • daisy.it

and only mickey , daisy run https ready, need conditional rewrite condition add web.cofig

my web.config file has typical wordpress rewrite rules , not more:

  <rules>     <rule name="wordpress rule 1" stopprocessing="true">       <match url="^index\.php$" ignorecase="false" />       <action type="none" />     </rule>     <rule name="wordpress rule 2" stopprocessing="true">       <match url="^([_0-9a-za-z-]+/)?files/(.+)" ignorecase="false" />       <action type="rewrite" url="wp-includes/ms-files.php?file={r:2}" appendquerystring="false" />     </rule>     <rule name="wordpress rule 3" stopprocessing="true">       <match url="^([_0-9a-za-z-]+/)?wp-admin$" ignorecase="false" />       <action type="redirect" url="{r:1}wp-admin/" redirecttype="permanent" />     </rule>     <rule name="wordpress rule 4" stopprocessing="true">       <match url="^" ignorecase="false" />       <conditions logicalgrouping="matchany">         <add input="{request_filename}" matchtype="isfile" ignorecase="false" />         <add input="{request_filename}" matchtype="isdirectory" ignorecase="false" />       </conditions>       <action type="none" />     </rule>     <rule name="wordpress rule 5" stopprocessing="true">       <match url="(^[_0-9a-za-z-]+/)?(wp-(content|admin|includes).*)" ignorecase="false" />       <action type="rewrite" url="{r:2}" />     </rule>     <rule name="wordpress rule 6" stopprocessing="true">       <match url="^([_0-9a-za-z-]+/)?(.*\.php)$" ignorecase="false" />       <action type="rewrite" url="{r:2}" />     </rule>     <rule name="wordpress rule 7" stopprocessing="true">       <match url="." ignorecase="false" />       <action type="rewrite" url="index.php" />     </rule>   </rules> 

where , new rule apply (avoiding broke existing ones)?

since url rewrite module uses regex, i'm pretty sure going in right direction.

<rule name="http https" enabled="true" stopprocessing="true">     <match url=".*(mickey.it|donald.it).*" />     <conditions>         <add input="{https}" pattern="^off$" />     </conditions>     <action type="redirect" url="https://{http_host}/{r:1}" redirecttype="seeother" /> </rule> 

could fancier regex here, should valid in basic sense.

i played around bit , seemed work...


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -