code: public static function niceUrl(string $url)
      {
          $nice = null;
          if (($pos = stripos($url, '.')) !== false) {
              list($subDomain, $url) = explode('.', $url);
              $request = Http::getRequest();
              $nice = $request->getRawRequest()->getScheme() . '://';
              if ($subDomain != null) {
                  $nice .= $subDomain . '.';
              }
              $nice .= self::extractDomain($request->getRawRequest());
          }
  
          return $nice . '/' . ltrim((string) preg_replace('/\/+/', '/', $url), '/');
      }
docs: Get nice URL.
  
  @static
  @param  string $url raw URL
  @return string nice URL