We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

URL Rewrite to different web applicationsRSS

3 replies

Last post Jun 15, 2021 12:52 AM by raamakarthikeyan.m

‹ Previous Thread|Next Thread ›
  • URL Rewrite to different web applications

    Jan 26, 2017 11:26 PM|nleaphart|LINK

    Hello,

    Here's my scenario. I have two web applications running under one web site on my server. I would like to configure my server so that if a user navigates to a specific URL they will access a specific web application. Specifically, the web apps are a mobile app and a standard desktop app.

    For example, if a user types in "http://webbapplicationA" I would like them to be redirected to "http://webserver/appA". If a user types in "http://webapplicationB" they should go to "http://webserver/appB".

    I've accomplished this before using Host Headers. However, since these are web applications running on the same site, I can't use Host Headers (as far as I know).

    Is it possible to use the URL Rewrite module to accomplish this? 

  • Rovastar Rovastar

    5495 Posts

    MVP

    Moderator

    Re: URL Rewrite to different web applications

    Jan 27, 2017 02:20 AM|Rovastar|LINK

    You can use URLrewrite set the HTTP_HOST in the condition.
    Troubleshoot IIS in style
    https://www.leansentry.com/
  • Re: URL Rewrite to different web applications

    Jan 27, 2017 10:51 AM|Yuk Ding|LINK

    Hi nleaphart,

    If you want user type in web applicationA to access your server node, you still need the binding host header with webbapplicationA, otherwise the request could not be routed to your IIS side and there URL rewrite module will have no chance to redirect the URL. Once you added the binding host header, then you could create the rule like:

    <rule name="rewrite append query string" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions trackAllCaptures="true">
                              <add input="{URL}" pattern="^/(.*)" />
                                    <add input="{HTTP_HOST}" pattern="webbapplication(.*)" />
                        </conditions>
                        <action type="Rdirect" url="http://webserver/app{C:2}/{C:0}" />
                    </rule>

    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: URL Rewrite to different web applications

    Jun 15, 2021 12:52 AM|raamakarthikeyan.m|LINK

    Hello Yuk Ding

    Can this redirection be achieved using "rewrite" Action instead of "redirect" Action. I dont want the end user to see in browser the redirect. Basically i want to do a server transfer instead of client transfer between 2 applications on same site.

‹ Previous Thread|Next Thread ›