如果在文件夹下,我需要设置规则以将用户从一个子域推送到另一个子域。我需要搬家
- teststore.domain.edu/admin*
- devstore.domain.edu/admin*
- anysubdomain.domain.edu/admin*
到
- store.admin.domain.edu/admin
这行得通!
但我需要重写任何内容
- store.admin.domain.edu
到
- store.admin.domain.edu/admin
但这并没有,实际上除了
- store.admin.domain.edu/media*
- store.admin.domain.edu/js*
- store.admin.domain.edu/skin*
- store.admin.domain.edu/api*
- store.admin.domain.edu/admin/oauth_authorize*
- store.admin.domain.edu/index.php/admin*
需要将重定向写入
- store.admin.domain.edu/admin*
我几乎拥有它,但 store.admin.domain.edu 通过以下规则重写为 devstore.domain.edu,因为它没有被捕获。我不能在下面的规则中添加任何内容,它是生成的。
<!-- RULES TO PUSH ADMIN TO SUBDOMAIN -->
<rule name="admin" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="store.admin.domain.edu" negate="true" />
<add input="{URL}" pattern="^(.*?)/admin(.*?)" />
</conditions>
<action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="admin_rooted" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="store.admin.domain.edu" />
<add input="{URL}" pattern="^/(api|oauth_authorize|media|skin|js)" negate="true" />
<add input="{URL}" pattern="^admin*" negate="true" />
<add input="{REQUEST_URI}" pattern="^index.php/admin/*" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" />
</rule>
<!-- END OF RULES TO PUSH ADMIN TO SUBDOMAIN -->
<!-- rules that are generated -->
<rule name="default_store">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{SERVER_NAME}" pattern="^devstore\.domain\.edu*" />
</conditions>
<serverVariables>
<set name="HTTP_X_MAGE_RUN_CODE" value="base" replace="true" />
<set name="HTTP_X_MAGE_RUN_TYPE" value="website" replace="true" />
</serverVariables>
<action type="None" />
</rule>
<rule name="general_rewrite">
<match url="(.*)" />
<action type="Rewrite" url="index.php" />
<conditions>
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
</rule>