Ignore files from route

hello everyone, i am having some problems with my routes. i have the following route

members/(:any)

to show virtual pages of members. everything works fine. problem is, the members page itself has some files, for instance a .csv file. this means the file URL is

members/mycsv.csv

is there a way i can bypass files in the route? otherwise i am getting an error in the route, since in the action i only return the virtual pages, so maybe something like this?

'action'  => function ($nameslug) {
            if (!str_contains($nameslug, '.csv')) { // this is of course not nice, since i only check csv
                $vPage = prepUserPage($nameslug); //  i create the virtual page somewhere else
                return  $vPage;
            } else {
                // what do i do here?
            }
}

also, would this be the best place to do it? or should i do it in a route:before hook?

thank you in advance!

Instead of the any placeholder, use a regex pattern/placeholder that excludes dots, for example (:alpha) or (:alphanum), or use $this->next()if the page does not exist to let Kirby handle the routing…

thank you sonja. sadly the member pages can look like this

sonja-profile

so alphanum would not work, correct?

$this->next() seems to be working though :slight_smile: thank you!

right

(Just wanted to stress again that you are by no means limited to the placeholder patterns, but can use any regex pattern that fulfills your needs)