RouteNotFoundException thrown when trying to reroute I am converting a Drupal 7 module to Drupal 8. The purpose of this module is to have shorter URLs which can be shared, as an alternative of /node/123 the module should send people typing /n/123 to the same content.

I feel like I am pretty close to competion but there is 1 more issue.
When I try using the 'littlurl' I get this error Symfony\Component\Routing\Exception\RouteNotFoundException: Route "node" does not exist. in Drupal\Core\Routing\RouteProvider-&gt;getRouteByName() (line 187 of C:\Users\SAMUEL\Sites\devdesktop\Module3\core\lib\Drupal\Cor‌​e\Routing\RouteProvi‌​der.php).

routing.yml

littlurl.node:
  path: /n/{nodeid}
  defaults:
    _controller: '\Drupal\littlurl\Controller\DefaultController::nodeForward'
  requirements:
    _permission: 'access content'

littlurl.user:
  path: /u/{userid}
  defaults:
    _controller: '\Drupal\littlurl\Controller\DefaultController::userForward'
  requirements:
    _permission: 'access content'

littlurl.taxonomy:
  path: /t/{taxid}
  defaults:
    _controller: '\Drupal\littlurl\Controller\DefaultController::taxonomyForward'
  requirements:
    _permission: 'access content'


controller.php file

&lt;?php /**
 * @file
 * Contains \Drupal\littlurl\Controller\DefaultController.
 */

namespace Drupal\littlurl\Controller;

use Drupal\Core\Controller\ControllerBase;
use \Symfony\Component\HttpFoundation\RedirectResponse;
/*use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;*/

/**
 * Default controller for the littlurl module.
 */
class DefaultController extends ControllerBase {

  public function nodeForward($nodeid) {
    $route_parameters[0] = $nodeid;
    $options['absolute'] = TRUE;
    $url = $this-&gt;url("node", $route_parameters, $options);
    $response = new RedirectResponse($url);
    $response-&gt;send();
  }

  public function userForward($userid) {
    $route_parameters[0] = $userid;
    $options['absolute'] = TRUE;
    $url = $this-&gt;url("user", $route_parameters, $options);
    $response = new RedirectResponse($url);
    $response-&gt;send();
  }

  public function taxonomyForward($taxid) {
    $route_parameters[0] = $taxid;
    $options['absolute'] = TRUE;
    $url = $this-&gt;url("taxonomy", $route_parameters, $options);
    $response = new RedirectResponse($url);
    $response-&gt;send();
  }

}
These are the routes for content entities in a drupal standard install:

 entity.block_content.canonical                        /block/{block_content}
 entity.comment.canonical                              /comment/{comment}
 entity.contact_form.canonical                         /contact/{contact_form}
 entity.menu_link_content.canonical                    /admin/structure/menu/item/{menu_link_content}/edit
 entity.node.canonical                                 /node/{node}
 entity.taxonomy_term.canonical                        /taxonomy/term/{taxonomy_term}
 entity.user.canonical                                 /user/{user}


In this list the route parameter names are in {}. Put the parameter name as key in an array:

$route_parameters = ['node' =&gt; $nodeid];


Don't send the response, return it:

return $response;