title: IIS redirect from one subdomain to another
body: <p>I need to set up rules to push a user from one subdomain if under a folder to another.  I need to move </p>
  
  <ul>
  <li>teststore.domain.edu/admin*</li>
  <li>devstore.domain.edu/admin*</li>
  <li>anysubdomain.domain.edu/admin*</li>
  </ul>
  
  <p>to </p>
  
  <ul>
  <li>store.admin.domain.edu/admin</li>
  </ul>
  
  <p>This works!</p>
  
  <p>but I need to rewrite anything under</p>
  
  <ul>
  <li><strong>store.admin.domain.edu</strong> </li>
  </ul>
  
  <p>to </p>
  
  <ul>
  <li>store.admin.domain.edu/admin</li>
  </ul>
  
  <p>and that doesn't, and really anything but</p>
  
  <ul>
  <li>store.admin.domain.edu/media*</li>
  <li>store.admin.domain.edu/js*</li>
  <li>store.admin.domain.edu/skin*</li>
  <li>store.admin.domain.edu/api*</li>
  <li>store.admin.domain.edu/admin/oauth_authorize*</li>
  <li>store.admin.domain.edu/index.php/admin*</li>
  </ul>
  
  <p>would need to write redirect to </p>
  
  <ul>
  <li>store.admin.domain.edu/admin*</li>
  </ul>
  
  <p>I almost have it but store.admin.domain.edu rewrites to devstore.domain.edu through a rule below as it was not caught.  I can't put anything in the rule below, it is generated.</p>
  
  <pre><code>&lt;!-- RULES TO PUSH ADMIN TO SUBDOMAIN --&gt;
  &lt;rule name="admin" stopProcessing="true"&gt;
    &lt;match url="(.*)"  ignoreCase="true" /&gt;
    &lt;conditions logicalGrouping="MatchAll"&gt;
      &lt;add input="{HTTP_HOST}" pattern="store.admin.domain.edu" negate="true" /&gt;
      &lt;add input="{URL}" pattern="^(.*?)/admin(.*?)" /&gt;
    &lt;/conditions&gt;
    &lt;action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" /&gt;
  &lt;/rule&gt;
  &lt;rule name="admin_rooted" stopProcessing="true"&gt;
    &lt;match url="(.*)"  ignoreCase="true" /&gt;
    &lt;conditions logicalGrouping="MatchAll"&gt;
      &lt;add input="{HTTP_HOST}" pattern="store.admin.domain.edu" /&gt;
      &lt;add input="{URL}" pattern="^/(api|oauth_authorize|media|skin|js)" negate="true" /&gt;
      &lt;add input="{URL}" pattern="^admin*" negate="true" /&gt;
      &lt;add input="{REQUEST_URI}" pattern="^index.php/admin/*" negate="true" /&gt;
      &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
      &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
    &lt;/conditions&gt;
    &lt;action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" /&gt;
  &lt;/rule&gt;
  &lt;!-- END OF RULES TO PUSH ADMIN TO SUBDOMAIN --&gt;
  
  
  
  &lt;!-- rules that are generated --&gt;
  &lt;rule name="default_store"&gt;
      &lt;match url="(.*)" ignoreCase="true" /&gt;
      &lt;conditions&gt;
        &lt;add input="{SERVER_NAME}" pattern="^devstore\.domain\.edu*" /&gt;
      &lt;/conditions&gt;
      &lt;serverVariables&gt;
        &lt;set name="HTTP_X_MAGE_RUN_CODE" value="base" replace="true" /&gt;
        &lt;set name="HTTP_X_MAGE_RUN_TYPE" value="website" replace="true" /&gt;
      &lt;/serverVariables&gt;
      &lt;action type="None" /&gt;
  &lt;/rule&gt;
  &lt;rule name="general_rewrite"&gt;
      &lt;match url="(.*)" /&gt;
      &lt;action type="Rewrite" url="index.php" /&gt;
      &lt;conditions&gt;
          &lt;add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" /&gt; 
          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
      &lt;/conditions&gt;
  &lt;/rule&gt;
  </code></pre>