CodeIgniter Forums
Redirect rule in routes with multi-app setup - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Redirect rule in routes with multi-app setup (/showthread.php?tid=74598)



Redirect rule in routes with multi-app setup - JoellSVK - 10-13-2019

Hello, is it possible to redirect from routes to a specific URL? I have multi-app setup using single CI installation, a shared app and independent apps and I would like to make a redirect from one to another by calling specific "index.php" file fore that app.

So basically it would be full redirect and not only routing option to the controller. Of course, another option here is using filter to make redirect there. Just asking if it is possible to do in the router as well.

Code:
$routes->group('admin', function ($routes){
    $routes->addRedirect('/', 'specific.index.php'); // <- This doesn' work
    $routes->add('login', 'Login::index', ['namespace' => '\Admin\Controllers\Auth']);
});

Thank You in advance ^-^


RE: Redirect rule in routes with multi-app setup - JoellSVK - 10-13-2019

Found solution at the end. Simply by passing to option 'hostname' = $_SERVER['HTTP_HOST']