Import legacy site URLs via url_alias table I have a long table of legacy site URLs (Drupal 6 site) and the new URLs they should redirect to on the new site (Drupal 8). The list is too long to make this an .htaccess fix, and too irregular for an easy rule.

I tried simply inserting the rows into the url_alias table and have found that they don't work unless I find them in the URL Aliases admin page, edit them and save them. I guess this means that the redirects are stored somewhere else as well as that table. Clearing the cache manually didn't seem to help.

I can't think of a way to do what I need with the various path / redirect modules I've found so far (though I'm really open to trying) and most of the code samples out there are D6 or D7. Is there a way (as a one-off) that I can get Drupal to re-read the entire url_alias table and make them proper redirects? Or is there another way to get all the redirects in place? Any help much appreciated!
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'])'