Reputation: 1476
I need to set up rules to push a user from one subdomain if under a folder to another. I need to move
to
This works!
but I need to rewrite anything under
to
and that doesn't, and really anything but
would need to write redirect to
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.
<!-- 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>
Upvotes: 2
Views: 2174
Reputation: 11762
I have changed your 2 rules to make them more simple:
<rule name="admin" stopProcessing="true">
<match url="^admin" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^store.admin.domain.edu$" negate="true" />
</conditions>
<action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="admin_rooted" stopProcessing="true">
<match url="^(api|oauth_authorize|media|skin|js|admin|index.php/admin/)" ignoreCase="true" negate="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^store.admin.domain.edu$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="http://store.admin.domain.edu/admin" appendQueryString="false" redirectType="Permanent" />
</rule>
The first rule will redirect any url starting with admin
and not pointing to the host store.admin.domain.edu
to http://store.admin.domain.edu/admin
.
The second one will redirect any url that doesn't start with on of the following occurence: api
or oauth_authorize
or media
or skin
or js
or admin
or index.php/admin/
pointing to the host store.admin.domain.edu
and not being the path to a file or a directory to http://store.admin.domain.edu/admin
.
Upvotes: 1