View Complete Thread
  • How to add HTTP_HOST sub-subdomain using pattern?

    Nov 05, 2019 05:09 PM|scogordo|LINK

    I have a situation where I have two URLs going to the same content. There are customizations to the code that only work with one of the urls. The URL that works has a sub-subdomain, "HR", as shown in the second step. I need all requests for http://intranet.contoso.local/sites/hr/SitePages/hr.aspx specifically  to redirect to

    http://HR.intranet.contoso.local/sites/hr/SitePages/hr.aspx. None of the other pages in the site should redirect, just this specific one:

    1. identify an HTTP_HOST and REQUEST_URI pattern for http://intranet.contoso.local/sites/hr/SitePages/hr.aspx
    2. add a sub-subdomain, http://HR.intranet.contoso.local/sites/hr/SitePages/hr.aspx

    Here is the code I plan to use, however, I am concerned that the <add input="{HTTP_HOST}" pattern="^intranet.contoso.local$" /> is going to create an endless loop.

     		<rule name="Force intranet.contoso.local to HR.intranet.contoso.local" enabled="false" stopProcessing="true">
                        <match url="(.*)" />
                             <add input="{HTTP_HOST}" pattern="^intranet.contoso.local$" />
                            <add input="{REQUEST_URI}" pattern="^/sites/hr/SitePages/hr\.aspx" ignoreCase="true" negate="false" />
                        <action type="Redirect" url="HR.intranet.contoso.local/sites/hr/SitePages/hr.aspx#" />

    Related to (Thanks 

    Jalpa Panchal!)