title: How to redirect to a sub directory in react using react router?
body: <p>I have a react application installed at root domain suppose domain.com and I have installed Wordpress in a sub directory named domain.com/blog. If I add empty route like <code>&lt;Route exact path=&quot;/blog&quot; /&gt;</code> , I get a blank page.
  Is there a way to access .php or .html files in a sub directory outside of the react components?</p>
  <p>Please refer the routing code below</p>
  <pre><code>    &lt;BrowserRouter&gt;
            &lt;Switch&gt;
              &lt;Switch&gt;
                &lt;Route exact path=&quot;/&quot; render={(props) =&gt; &lt;Index {...props} /&gt;} /&gt;
      
                {/*route added since /blog redirects to / because of 404 condition at the bottom */}
                {/* &lt;Route exact path=&quot;/blog&quot; /&gt; */}
      
                {/*404 redirection for other URLs */}
                &lt;Redirect to=&quot;/&quot; /&gt;
                &lt;Redirect from=&quot;/&quot; to=&quot;/&quot; /&gt;
              &lt;/Switch&gt;
            &lt;/Switch&gt;
          &lt;/BrowserRouter&gt;
  </code></pre>
  <p>Because of the Redirects added below if I don't provide a route for /blog it redirects to root '/' URL (This is the 404 page not found condition).</p>