drupal 8 get url from public base_url code example Example: drupal 8 get site base url $host = \Drupal::request()->getSchemeAndHttpHost();