diff --git a/core/lib/Drupal/Core/Routing/PathBasedGeneratorInterface.php b/core/lib/Drupal/Core/Routing/PathBasedGeneratorInterface.php
index 5c91e62..ea6b910 100644
--- a/core/lib/Drupal/Core/Routing/PathBasedGeneratorInterface.php
+++ b/core/lib/Drupal/Core/Routing/PathBasedGeneratorInterface.php
@@ -30,6 +30,20 @@
   public function generateFromPath($path = NULL, $options = array());
 
   /**
+   * Gets the path of route.
+   *
+   * @param string $name
+   *  The route name.
+   * @param array $parameters
+   *   The parameters which should replace placeholders in the pattern of the
+   *   route to replace the proper path.
+   *
+   * @return string
+   *  The path of the route without an starting slash.
+   */
+  public function getPathFromRoute($name, $parameters = array());
+
+  /**
    * Sets the $request property.
    *
    * @param \Symfony\Component\HttpFoundation\Request $request
diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 04c2c17..501dd34 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -105,10 +105,9 @@ public function setRequest(Request $request) {
   }
 
   /**
-   * Implements Symfony\Component\Routing\Generator\UrlGeneratorInterface::generate().
+   * {@inheritdoc}
    */
-  public function generate($name, $parameters = array(), $absolute = FALSE) {
-
+  public function getPathFromRoute($name, $parameters = array()) {
     if ($name instanceof SymfonyRoute) {
       $route = $name;
     }
@@ -138,6 +137,17 @@ public function generate($name, $parameters = array(), $absolute = FALSE) {
       $path = substr($path, strlen($base_url));
     }
 
+    // Remove the starting "/".
+    return ltrim($path, '/');
+  }
+
+  /**
+   * Implements Symfony\Component\Routing\Generator\UrlGeneratorInterface::generate().
+   */
+  public function generate($name, $parameters = array(), $absolute = FALSE) {
+    $path = '/' . $this->getPathFromRoute($name, $parameters);
+    $base_url = $this->context->getBaseUrl();
+
     $path = $this->processPath($path);
     if (!$absolute || !$host = $this->context->getHost()) {
       return $base_url . $path;
