Redirect/Rewrite inside a Web applicationRSS

1 reply

Last post May 28, 2019 02:59 AM by Able

  • Redirect/Rewrite inside a Web application

    May 27, 2019 12:14 PM|eladfern|LINK

    Hay

    I have a web site: that has a rewrite rule which take any redirect from :

     www.contoso.com to www.contoso.com/local/client

    now i have a web application under this site:

    www.contoso.com/app

    i want that any request to www.contoso.com/app will redirect to www.contoso.com/local/client

    Thaks

    Elad

  • Re: Redirect/Rewrite inside a Web application

    May 28, 2019 02:59 AM|Able|LINK

    Hi eladferm,

    According to your description, I have made a samle here. I suggest that you could use IIS url rewirte  module in iis.You could add below rule in your web.config file of your web application.

    <system.webServer>
            <rewrite>
                <rules>
                    <rule name="rule1" stopProcessing="true">
                        <match url="^app$" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{HTTP_HOST}" pattern="www.contoso.com" />
                        </conditions>
                        <action type="Redirect" url="local/client" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>

    Here is the link for url rewrite ,I hope it could help you.

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

    Best Regards

    Able

    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.