i am trying to rewrite the views url pagination :
/mypath/cat?page=1
to
/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 ?