Routes pattern for multilanguage site

Something like this should work too.
Looks ugly but gets the job done :wink:

$kirby->set('route', [
  'pattern' => '(?:(^[A-Za-z]{2})//?)?(:any)/download/([a-f0-9]{32})',
  'action'  => function($lang, $page_uri, $hash) {
    $lang = $lang ?: 'en'; // the default language
    // do stuff
  }
]);
2 Likes