title: Redirect to Home page if URL not found
body: <p><strong>For following scenario, I have to redirect to home page if entered url not found.</strong></p>
  <p>When user try to access page which is not available, it should redirect to home page or error page.
  <strong>CODE:</strong>
  *</p>
  <pre><code>function App() {
    return (
      &lt;div className=&quot;app&quot;&gt;
        &lt;Suspense fallback={&lt;div&gt;Loading...&lt;/div&gt;}&gt;
          &lt;Router history={history}&gt;
            &lt;Header /&gt;
            &lt;div className=&quot;app-container&quot;&gt;
              &lt;Switch&gt;
                {routes.map(
                  ({ key, path, crumbs, renderComponent }) =&gt; {
                    return (
                      &lt;Route key={key} path={path}&gt;
                        {renderComponent(crumbs)}
                      &lt;/Route&gt;
                    )
                  }
                )}
                &lt;Redirect exact from=&quot;/&quot; to=&quot;/merchants&quot; /&gt;
              &lt;/Switch&gt;
            &lt;/div&gt;
            &lt;div className=&quot;footer-wrapper&quot;&gt;
              &lt;div className=&quot;footer&quot;&gt;
                &lt;footer max-width=&quot;1920&quot;&gt;&lt;/footer&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/Router&gt;
        &lt;/Suspense&gt;
      &lt;/div&gt;
    )
  }
  </code></pre>