Redirecting to a page based on the sub-domain
The linked post points in the right directions, but contains a lot of code you don't need. Use this change record https://www.drupal.org/node/2013014 instead and check $request->getHost():

  public function checkForRedirection(GetResponseEvent $event) {
    if ($event-&gt;getRequest()-&gt;getHost() == '...') {
      $event-&gt;setResponse(new RedirectResponse('http://example.com/foo/'));
    }
  }


For a non-coding solution you can try Redirect Domain, a submodule of Redirect.