Reputation: 1625
I have requirement to point www.example.com/umbraco to admin.example.com in iis.When user access to admin.example.com it should load umbraco backoffice. Thanks in advance
Upvotes: 0
Views: 121
Reputation: 8736
I guess the main goal is to protect Umbraco admin area. You can do that with rewrite rules. I presume that your website in IIS already has two bindings: www.example.com
and admin.example.com
. Add this rules into your web.config:
<rules>
<rule name="redirect to umbraco" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^admin.example.com$" />
</conditions>
<action type="Redirect" url="umbraco" />
</rule>
<rule name="close umbraco from public" stopProcessing="true">
<match url="^umbraco(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^admin.example.com$" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" />
</rule>
<rule name="redirect non umbraco to public" stopProcessing="true">
<match url="^umbraco(.*)" negate="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^admin.example.com$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="http://www.example.com{REQUEST_URI}" />
</rule>
</rules>
This rules will:
1) Redirect from admin.example.com
to admin.example.com/umbraco
2) Close /umbraco*
urls if you will try to access it from www.example.com
domain.
3) Redirect all urls other than /umbraco*
from domain admin.example.com
to www.example.com
Upvotes: 1