Following up: Full code examples below of what worked and didn't...
Thanks for all the suggestions. Most failures end with a CI4 code exception: SYSTEMPATH/HTTP\Exceptions\HTTPException.php at line 106
The root problem for me is simply vague documentation about reverse routing. I've just no desire to poor through the CI4 system code.
I should mention I'm writing modules in different directories and namespaces with a "global" config, so I needed a general solution to redirect routing, etc...
PHP Code:
<?php namespace App\Controllers;
use CodeIgniter\Controller;
class Home extends Controller
{
//--------------------------------------------------------------------
// Just jump to a different controller...
// Remember to add the route: $routes->get('/(:any)', 'Home::$1');
public function index()
{
// in CI3: redirect('dummy'); // traditional.
// in CI4:
return redirect()->to( base_url('dummy') ); // this works (preferred solution I think)
//return redirect()->to('ci4/dummy')); // this works (/ci4 is my new "public" dir)
//$this->response->redirect('dummy'); // this also works
//$this->response->redirect(base_url('dummy')); // this version also works
// return redirect("dummy"); // fails with CI code exception
// return redirect(base_url('dummy')); // fails with CI code exception
// return redirect('App/Controller/Home::dummy'); // fails with CI code exception
}
//--------------------------------------------------------------------
public function dummy()
{
echo "Dummy route.";
}
}