redirect from root to subfolder RRS feed

  • Question

  • User-388594962 posted

    We have our Accounting/CRM platform that we need to redirect from the root website to a subfolder. 

    http://company.domain.com redirects to https://company.domain.com/subfolder1

    Our problem we just found in testing using the built-in redirect option in IIS 10 is there is a desktop app and when we click the link to access it from https://company.domain.com/subfolder1 we are getting a 404 error. Upon further examination we determined that the redirect is causing it to go to https://company.domain.com/subfolder1/subfolder2/application.file

    correct address should be https://company.domain.com/subfolder2/application.file

    Application support told me to use URL rewrite. So i have installed the IIS URL rewrite onto the web server.  I followed this guide to setup the redirect from http to https which is working.


    What I am stuck on is redirecting from the root website to http://company.domain.com to https://company.domain.com/subfolder1

    Anyhelp would be appreciated. 

    Thursday, May 13, 2021 7:32 PM

All replies

  • User-388594962 posted

    I finally got it to work. I setup 2 rules like so to get it to redirect all http to https requests and go from the root to the subfolder. 

    <?xml version="1.0" encoding="UTF-8"?>
            <httpRedirect enabled="false" destination="" />
                    <clear />
                    <rule name="Redirect to Https" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                            <add input="{HTTPS}" pattern="^OFF$" />
                        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
                    <rule name="Root to Subdirectory" stopProcessing="true">
                        <match url="^$" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="/subfolder1" />

    Thursday, May 13, 2021 9:28 PM
  • User1065476709 posted

    Hi EDSA-CTO,

    I'm so glad that the problem has been resolved. It is so appreciated if you can mark your solution as answer.

    Best regards,


    Friday, May 14, 2021 1:21 AM