alterRoutes() is not triggered I am trying to alter the route for the login and registration pages. I followed Altering existing routes and adding new routes based on dynamic ones. I cleared the cache repeatedly, and re-enabled the module several times, but it looks like alterRoutes() is not triggered, even when I try to add a kint() debug or any code. 

What I noticed is that alterRoutes() -> kint() is triggered when I use Drush to enable the module. In this case, I see kint() output in my terminal. However, alterRoutes() is not triggered when viewing the site.

This is the code I am using.

md_routes/src/Routing/RouteSubscriber.php

namespace Drupal\md_routes\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Drupal\Core\Routing\RoutingEvents;
use Symfony\Component\Routing\RouteCollection;
/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    kint($collection);
    // Change path '/user/login' to '/login'.
    if ($route = $collection-&gt;get('user.login')) {
      $route-&gt;setPath('/login');
    }
    if ($route = $collection-&gt;get('user.register')) {
      $route-&gt;setPath('/register');
    }
  }
}


md_routes/md_routes.services.yml

services:
  md_routes.route_subscriber:
    class: Drupal\md_routes\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }
I did clear the drupal caches using the interface (admin/config/development/performance), it seems like drush is not clearing ALL caches. It does work now and i guess it was a caching issue. Thanks anyways!