diff --git a/src/Drupal/Commands/core/DrupalCommands.php b/src/Drupal/Commands/core/DrupalCommands.php
index 286f8c2ce3..0bf2f14552 100644
--- a/src/Drupal/Commands/core/DrupalCommands.php
+++ b/src/Drupal/Commands/core/DrupalCommands.php
@@ -145,8 +145,10 @@ public function requirements($options = ['format' => 'table', 'severity' => -1,
* View details about the update.status route.
* @usage drush route --path=/user/1
* View details about the entity.user.canonical route.
+ * @usage drush route --url=https://example.com/node/1
+ * View details about the entity.node.canonical route.
* @option name A route name.
- * @option path An internal path.
+ * @option path An internal path or URL.
* @version 10.5
*/
public function route($options = ['name' => self::REQ, 'path' => self::REQ, 'format' => 'yaml'])
@@ -154,6 +156,11 @@ public function route($options = ['name' => self::REQ, 'path' => self::REQ, 'for
$route = $items = null;
$provider = $this->getRouteProvider();
if ($path = $options['path']) {
+ if (filter_var($path, FILTER_VALIDATE_URL)) {
+ $path = parse_url($path, PHP_URL_PATH);
+ // Strip base path.
+ $path = '/' . substr_replace($path, '', 0, strlen(base_path()));
+ }
$name = Url::fromUserInput($path)->getRouteName();
$route = $provider->getRouteByName($name);
} elseif ($name = $options['name']) {