framework icon indicating copy to clipboard operation
framework copied to clipboard

Auto-dispatch subdomain to module

Open Yahasana opened this issue 6 years ago • 1 comments

http://admin.example.com will auto route to and load admin module

Yahasana avatar Sep 13 '18 11:09 Yahasana

How about if you set a default module to router:

$this->di->set('router', function () use ($request) {
	$router = new Router();

	switch ($request->getServer('HTTP_HOST')) {
		case 'admin.example.com':
			$router->setDefaultModule('admin');
			break;
		default:
			$router->setDefaultModule('front');
			break;
	}

	return $router;
});

mruz avatar Sep 13 '18 13:09 mruz