title: How do you redirect to the "base URL" if a web page is not found in CodeIgniter 4?
body: <p>How do you redirect to <code>base_url()</code> if a page is not found that matches the current URI?</p>
  <p>I have tried this in <code>app/Config/Routes.php</code>, but it's not working:</p>
  <pre><code>$routes-&gt;set404Override(function () {
      return redirect()-&gt;to(base_url());
  });
  </code></pre>