I'm trying to use an Inbound Path Processor to redirect a path(to a webapp based on this tutorial), but Drupal is not picking it up.

I tried the following code to simply redirect every page on the site to /happy, but after rebuilding the cache, nothing happens; I can navigate the site normally and never get redirected.


namespace Drupal\mymodule\PathProcessor;

use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Symfony\Component\HttpFoundation\Request;

class MyPathProcessor implements InboundPathProcessorInterface {

  public function processInbound($path, Request $request) {
    return '/happy';


Am I using this wrong? What do I need to do to get Drupal to use the path processor?

  • 2
    This is not a redirect by the way. Path processing is like rewriting in .htaccess without [R,L]. If you want to rewrite the path with a redirect you can use an event subscriber. See drupal.org/node/2013014
    – 4uk4
    Commented Aug 15, 2021 at 9:04

1 Answer 1


A path processor is a service tagged with path_processor_inbound. For example, this is the definition of the path_processor.files path processor used by Drupal core.

  class: Drupal\system\PathProcessor\PathProcessorFiles
    - { name: path_processor_inbound, priority: 200 }

Keep in mind that all the path processors are invoked. If the path set by a path processor isn't used from Drupal, another path processor could have changed it. Services like path_processor.files use the priority for that reason: to avoid conflicts with other services of the same type which, in this case, could change the path already altered by another path processor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.