/**
  * {@inheritDoc}
  */
 public function switchInstance(InstanceInterface $instance)
 {
     if (!array_key_exists('HTTP_HOST', (array) $_SERVER)) {
         throw new Exception\RuntimeException(sprintf('Host not set.'));
     }
     $url = $this->router->assemble($this->routeMatch->getParams(), ['name' => $this->routeMatch->getMatchedRouteName()]);
     $hostNames = explode('.', $_SERVER['HTTP_HOST']);
     $tld = $hostNames[count($hostNames) - 2] . "." . $hostNames[count($hostNames) - 1];
     $url = 'http://' . $instance->getSubdomain() . '.' . $tld . $url;
     $this->redirect($url);
 }