3.6. Pagination: changing target url



my pagination links look like this:

What can I do to get a more seo friendly naming?
For example like:

What I already got is to modfiy the search form via jQuery to change the form action depending on the search - so I land already on the search results page with this url looking like

I just need “to tell pagination” to use the URL and just add the vars.
What can I do to get this?



You’ll need to setup the correct routes. Take a look at https://book.cakephp.org/3.0/en/development/routing.html#routes-configuration

Once that is done, the CakePHP router should take care of everything for you.


Hi dakota. Yes I already tried but I can’t find a proper solution for this. Or in other words, I don’t know what exactly to look for on my specific case. Would it be possible to get some specific help from you?


Whats the exact controllers, etc. that you have? I can only try to help if I know the real names you are using :slight_smile:


Hi dakota,


controller = objekts
action = search

thanks so much!!


Hey heohni,

you should define a Route in the routes.php for your needs like:

['plugin' => 'MyPlugin', 'controller' => 'TheController', 'action' => 'TheAction']

Its very simple - or read the docs https://book.cakephp.org/3.0/en/development/routing.html#quick-tour


So, you want http://localhost/objekts/search?page=4&cat_id=1?


What I have by cake default is this:


What I want is that the pagination number links point to

in case I have reg_id and cat_id


in case I have only cat_id


Let me define this:

When using this (thanks MarksSoftware)
[‘controller’ => ‘objekts’, ‘action’ => ‘search’]

my links look like:

On page:

localhost/Apartments (this is shown in the browsers address bar)

the pagination number links look now like


so far - we getting closer.
What can I do now that route takes the part “Apartments” from the address bar?

To get a link like