# Pagination: removing "page;" from the url pattern

**URL:** <https://forum.getkirby.com/t/pagination-removing-page-from-the-url-pattern/19784>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 19, 2020, 10:54am UTC](https://forum.getkirby.com/t/pagination-removing-page-from-the-url-pattern/19784 "2020-10-19T10:54:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lutz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lutz/32/4376_2.png) [@lutz](https://forum.getkirby.com/u/lutz)\
**Post date:** [October 19, 2020, 10:54am UTC](https://forum.getkirby.com/t/pagination-removing-page-from-the-url-pattern/19784/1 "2020-10-19T10:54:28Z")

</div>

By using the built-in Kirby pagination, the current URL is extended by “page; 2” or “page; 3”. Example: The URL https: [//kirby.fantastic-asia.local/Individualreisen](https://kirby.fantastic-asia.local/Individualreisen) becomes https: [//kirby.fantastic-asia.local/Individualreisen/page](https://kirby.fantastic-asia.local/Individualreisen/page); 2. I want the ‘/page;2’ to go away. The last parameter looks to me like a GET that is simply appended to the URL. Therefore I have created the following routes in the config. php:

```auto
'routes' => 
[
    [
         'pattern' => 'Individual trips /? page; = (: num)',
         'action' => function ($ page) {
           go ('Individual Travel /'.$ page);
         }
       ],
       [
         'pattern' => 'Individual trips / (: num)',
         'action' => function ($ page) {
           $ _GET ['page'] = $ page;
           return site () -> visit (page ('Individual Travel'));
         }
    ]
]

```

Unfortunately I don’t seem to meet the search pattern ‘Individualreisen /? Page; = (: num)’. Can anybody help me further?

Best regards  
Lutz

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [October 19, 2020, 11:44am UTC](https://forum.getkirby.com/t/pagination-removing-page-from-the-url-pattern/19784/2 "2020-10-19T11:44:41Z")

</div>

1. Variables start with a `$` character in PHP.
2. ` go()` needs a path to a page, not a page title
3. and most important, query strings and parameters cannot be queried in a pattern, you would have to check that inside the route.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 19, 2020, 6:43pm UTC](https://forum.getkirby.com/t/pagination-removing-page-from-the-url-pattern/19784/3 "2020-10-19T18:43:27Z")

</div>

What you would need is something like this:

```auto
'routes' => [

    [
      'pattern' => 'notes',
      'action' => function () {
          dump(param('page'));
          return go( 'notes/' . param('page') );
        
      }
    ],
    [
      'pattern' => 'notes/(:num)',
      'action' => function ($num) {
        $notes = page('notes')->children()->paginate(1);
        $pagination = $notes->pagination();
        if ( $num > $pagination->pages() ) {
          go('error');
        }
        $data = [
          'paginationPage' => $num,
        ];
        return page('notes')->render($data);
      }
    ]
  ]

```

But you would also have to handle this in your controller to make sure the correct pagination page is returned (therefore we return the page to controller when rendering the page).

Please indent your code properly using three backticks before and after your code block.
