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..d0b595f 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;
     }
@@ -139,6 +138,18 @@ public function generate($name, $parameters = array(), $absolute = FALSE) {
     }
 
     $path = $this->processPath($path);
+
+    // 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();
     if (!$absolute || !$host = $this->context->getHost()) {
       return $base_url . $path;
     }
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index 079213e..c530ff9 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -30,6 +30,11 @@
  */
 class UrlGeneratorTest extends UnitTestCase {
 
+  /**
+   * The url generator to test.
+   *
+   * @var \Drupal\Core\Routing\UrlGenerator
+   */
   protected $generator;
 
   protected $aliasManager;
@@ -105,6 +110,19 @@ function setUp() {
   public function testAliasGeneration() {
     $url = $this->generator->generate('test_1');
     $this->assertEquals('/hello/world', $url);
+
+    $path = $this->generator->getPathFromRoute('test_1');
+    $this->assertEquals('hello/world', $path);
+  }
+
+  /**
+   * Tests the url generation in a sub directory.
+   */
+  public function testGetPathFromRouteWithSubdirectory() {
+    $this->generator->setBasePath('/test-base-path');
+
+    $path = $this->generator->getPathFromRoute('test_1');
+    $this->assertEquals('hello/world', $path);
   }
 
   /**
@@ -113,6 +131,9 @@ public function testAliasGeneration() {
   public function testAliasGenerationWithParameters() {
     $url = $this->generator->generate('test_2', array('narf' => '5'));
     $this->assertEquals('/goodbye/cruel/world', $url, 'Correct URL generated including alias and parameters.');
+
+    $path = $this->generator->getPathFromRoute('test_2', array('narf' => '5'));
+    $this->assertEquals('goodbye/cruel/world', $path);
   }
 
   /**
@@ -123,6 +144,7 @@ public function testAbsoluteURLGeneration() {
     $this->assertEquals('http://localhost/hello/world', $url);
   }
 
+
   /**
    * Tests path-based URL generation.
    */
