i am trying to rewrite the views url pagination :



/mypath/cat/1 or > /mypath/cat/page/1 or /mypath/cat-1

cat is a taxonomy term.

I have tried to rewrite url with Drupal\seo\PathProcessor but without really success...

Code for rewrite /mypath/cat?page=1 to /mypath/cat-1 :

    public function processInbound($path, Request $request) {

        $page = \Drupal::request()->query->get('page');

        if($path == '/mypath/cat' && $page>0) {
            \Drupal::request()->query->set('page', $page);
            return $path.'-'.$page;

        return $path;

    public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
        return $path;

This ll redirect to /mypath/cat-1?page=1.

That broke the views filter too, it's normal.

i can alter the views filter for remove the "-" but how remove the ?page=1 from the uri ?

This is the right way for alter the url views pagination ?

1 Answer 1


In Drupal 7 you can use Query Parameters To URL but the D8 port needs more work. Maybe you can help with that in the course of the work for your current project?

It's similar with Clean Pagination that cleans up the pagination specifically, D8 needs more work.

In the meantime maybe you can replace some of the exposed Views filters with contextual ones, they take arguments separated with /.

With a Contextual filter you can display a Summary of taxonomy term names at the top of your views (or any region for that matter) instead of an exposed filter with the term names. That way you would see a list of terms as links at the top of your Views, and the links paths would look like mypath/cat.

Pagination would still add ?page=1 so you'd have mypath/cat?page=1 unless you get the Clean Pagination running.

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.