get current url type + drupal 8 code example Example: drupal 8 get site base url $host = \Drupal::request()->getSchemeAndHttpHost();