diff --git a/login_destination.module b/login_destination.module
index 9cd7f02..8a19b55 100644
--- a/login_destination.module
+++ b/login_destination.module
@@ -28,8 +28,9 @@ function login_destination_help($route_name, RouteMatchInterface $route_match) {
       $output .= '<h3>' . t('Uses') . '</h3>';
       $output .= '<dl>';
       $output .= '<dt>' . t('Creating login destinations') . '</dt>';
+      $url_data = Link::fromTextAndUrl('Login destination page', Url::fromRoute('login_destination.list'))->toString(TRUE);
       $output .= '<dd>' . t('Users with sufficient permissions can create login destination through the !link. The page listing the login destinations provides an interface to add, edit and delete them', [
-        '!link' => Link::fromTextAndUrl('Login destination page', Url::fromRoute('login_destination.list'))->toString(),
+        '!link' => $url_data->getGeneratedUrl(),
       ]) . '</dd>';
       $output .= '<dt>' . t('Assigning destinations') . '</dt>';
       $output .= '<dd>' . t('You can add login destinations and specify the page where the user will be redirected when it logs in or logs out. You can also configure specific pages where the destination can work or not and select for what user roles the login destination applies') . '</dd>';
diff --git a/src/LoginDestinationManager.php b/src/LoginDestinationManager.php
index 2ec890e..7a7303b 100644
--- a/src/LoginDestinationManager.php
+++ b/src/LoginDestinationManager.php
@@ -199,7 +199,8 @@ class LoginDestinationManager implements LoginDestinationManagerInterface {
       $path_destination = !empty($query) ? $query : '';
     }
     else {
-      $path_destination = Url::fromUri($path)->toString();
+      $url_data = Url::fromUri($path)->toString(TRUE);
+      $path_destination = $url_data->getGeneratedUrl();
     }
 
     // Set destination to current request.
