I need to redirect '/home' URL to '/' in Codeigniter 4.
The code below does it perfectly, but I wonder if there is a better way to do this inside the Routes.php file.
$routes->get('/', 'Pages::view/home');
$routes->get('/home', function()
{
header('Location: '.'/');
}
);
ANSWER
$routes->get('/', 'Pages::view/home');
$routes->addRedirect('/home', '/');