Import legacy site URLs via url_alias table
For storing aliases use Drupal\Core\Path\AliasStorage:

\Drupal::service('path.alias_storage')-&gt;save($source, $alias, $langcode);


But it should be no problem, if you inserted the rows by hand. Check, if all source paths and aliases have a leading '/'. And that langcode is set to a language like 'en' or 'und' for undefined.

Then clear the cache. It is enough to invalidate the cache tag 'route_match':

drush ev '\Drupal\Core\Cache\Cache::invalidateTags(['route_match'])'