title: Setup React application with React router to navigate components and URL rewrite to navigate sub applications in IIS
body: <p>I have a requirement where the root application (React + .NET core), for example - (example.com) has several components (myapp, dualapp) and React-Router is set to route to the components (example.com/myapp, example.com/dualapp).</p>
  <p>At the same time, i have two sub applications (React + .NET core), for example - (example1.com, example2.com). I would like to route to sub applications by using example.com/example1, example.com/example2 but the my current Router setup is redirecting example.com/example1 to the React Router and looking for the component in the root application.</p>
  <p>Can you please help on how to set up IIS rewrite to redirect to sub applications.</p>
  <p>My current IIS Rewrite setup is given below,</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
        &lt;rewrite&gt;
            &lt;rules&gt;
                &lt;rule name=&quot;example1&quot; stopProcessing=&quot;false&quot;&gt;
                    &lt;match url=&quot;example1/(.*)&quot; /&gt;
                    &lt;action type=&quot;Rewrite&quot; url=&quot;https://www.example1.com/{R:1}&quot; appendQueryString=&quot;true&quot; logRewrittenUrl=&quot;false&quot; /&gt;
                &lt;/rule&gt;
                &lt;rule name=&quot;example2&quot; stopProcessing=&quot;false&quot;&gt;
                    &lt;match url=&quot;example2/(.*)&quot; /&gt;
                    &lt;action type=&quot;Rewrite&quot; url=&quot;https://www.example2.com/{R:1}&quot; appendQueryString=&quot;true&quot; logRewrittenUrl=&quot;false&quot; /&gt;
                &lt;/rule&gt;
            &lt;/rules&gt;
        &lt;/rewrite&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>and the React-Router setup is given below,</p>
  <pre><code> &lt;BrowserRouter&gt;
      &lt;Switch&gt;
          &lt;Route exact path=&quot;/&quot;&gt;
              &lt;Dashboard /&gt;
          &lt;/Route&gt;
          &lt;Route path=&quot;/myapp&quot;&gt;
              &lt;Myapp /&gt;
          &lt;/Route&gt;
          &lt;Route path=&quot;/dualapp&quot;&gt;
              &lt;DualApp /&gt;
          &lt;/Route&gt;
      &lt;/Switch&gt;
  &lt;/BrowserRouter&gt;
  </code></pre>