5

Instead of rendering the URL object with toString() use the method Url::getInternalPath: $url = $link->getUrl(); if ($url->isRouted()) { $path = $url->getInternalPath(); }


3

This has nothing to do with drupal. Need to edit the .htaccess file RewriteEngine On RewriteRule ^test/(.*)$ /new/$1 [R=301,L] This will redirect example.com/test/1 to example.com/new/1


2

Upgrading and downgrading a site is not very well supported unless you also roll back the database. It seems this should help: Update pathauto to the latest version. Run the database updates. Update again to Drupal 8.8. Run the database updates. Ensure the path alias module is installed/enabled.


1

For example, what was example.com/old-style-alias might now be example.com/a-very-different-alias. Redirect module is exactly what you need. This can automatically add a redirect when you change the node's alias or you can manually add them to the redirect list, which gets saved to the DB.


Only top voted, non community-wiki answers of a minimum length are eligible