URL Rewrite to different web applications RRS feed

  • Question

  • User-1872122057 posted


    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? 

    Thursday, January 26, 2017 11:26 PM

All replies

  • User-2064283741 posted
    You can use URLrewrite set the HTTP_HOST in the condition.
    Friday, January 27, 2017 2:20 AM
  • User-460007017 posted

    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(.*)" />
                        <action type="Rdirect" url="http://webserver/app{C:2}/{C:0}" />

    Best Regards,

    Yuk Ding

    Friday, January 27, 2017 10:51 AM
  • User-1969980661 posted

    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.

    Tuesday, June 15, 2021 12:52 AM