diff --git a/src/PathAliasXtProcessorAlias.php b/src/PathAliasXtProcessorAlias.php
index aab6b5b..6b891c7 100644
--- a/src/PathAliasXtProcessorAlias.php
+++ b/src/PathAliasXtProcessorAlias.php
@@ -38,17 +38,31 @@ class PathAliasXtProcessorAlias extends PathProcessorAlias {
    * {@inheritdoc}
    */
   public function processInbound($path, Request $request) {
-    $path = Unicode::substr($path, 1);
+    $path_to_process = ltrim($path, '/');
 
-    while ($position = Unicode::strpos($path, '/')) {
-      $candidate_alias = '/' . Unicode::substr($path, 0, $position);
+    $removed_elements = [];
+    $path_elements = explode('/', $path_to_process);
 
-      if ($source = $this->aliasManager->getPathByAlias($candidate_alias)) {
-        return $source . Unicode::substr($path, $position);
+    foreach ($path_elements as $element) {
+      $candidate_alias = '/' . implode('/', $path_elements);
+      $source = $this->aliasManager->getPathByAlias($candidate_alias);
+
+      if ($source != $candidate_alias) {
+        // Change the order of the elements.
+        krsort($removed_elements);
+        $path = $source;
+        if (!empty($removed_elements)) {
+          $path .= '/' . implode('/', $removed_elements);
+        }
+
+        return $path;
       }
+      // Remove the last element from the elements array to be able to add it
+      // to the end of the found path.
+      $removed_elements[] = array_pop($path_elements);
     }
 
-    return parent::processInbound($path, $request);
+    return $path;
   }
 
   /**
@@ -59,7 +73,8 @@ class PathAliasXtProcessorAlias extends PathProcessorAlias {
 
     $config = $this->configFactory->get('path_alias_xt.settings');
     if (preg_match($config->get('regex_pattern'), Unicode::substr($path, 1), $matches)) {
-      if ($alias = $this->aliasManager->getAliasByPath("/$matches[1]/$matches[2]")) {
+      $langcode = isset($options['language']) ? $options['language']->getId() : NULL;
+      if ($alias = $this->aliasManager->getAliasByPath("/$matches[1]/$matches[2]", $langcode)) {
         $path = "$alias/$matches[3]";
       }
     }
