Use static domain for assets

From #6233.
to make more readable you could change logic to return early.

```php
if (file_uri_scheme($uri)) {
  // URL does not have a valid scheme
  return;
}

...
```