How to make exposed filters more readable in the URL? I'm trying to make my URLs a bit more readable (and persistent) which includes query parameters of a view's page. Usually the URL would look like this when I define an exposed filter which is addressed by the parameter vocabulary-foo: https://www.example.com/view?vocabulary-foo[]=1234. As you might have noticed, this is a filter for taxonomy terms of a specific vocabulary. There are two problems with the usage of IDs in the URL, which I'd like to solve:

If I uninstall my custom module that creates the taxonomy terms, these are gone and will get another ID when I install the module again. So I can't assume a link to a specific filtered view page would then still be the same.

It's not readable (and memorizable). Using the term's value instead of the ID would probably already help me. On the other hand, if it is possible to define a query parameter preset=something which translates to vocabulary-foo[]=&lt;The id of the term which has a specific value&gt;, I'd rather do that as it enables me to combine multiple query parameters to one preset, which makes it shorter.


In my specific case, the view exposes a form which can be used to search for content. A preset as described would pre-select some form controls with only one clean URL parameter.
One idea that came to my mind was somehow using PHP's $_GET variable and conditionally changing its content before the view is created. Unfortunately, I don't know which hook would be suitable for that.
Has somebody faced a similar issue in the past? How could I solve these problems in Drupal 9? Thanks!
There's no easy way to do that .. views better_exposed_filters is quite nice, but does not provide clean urls. Drupal 7 had query_parameters_to_url, for Drupal 8 they link to a sandbox! project ... This may be a starting point for you.
There may be a simpler approach here: Redirect based on query string using a redirect event subscriber:
&lt;?php
    static function getSubscribedEvents()
    {
        $events[KernelEvents::REQUEST][] = array('Redirect', 20);
        return $events;
    }

So you could provide at least clean urls to &quot;somewhere&quot;.