Routing index.php parameters


I am making redesign of website that already has content.

The old site uses old urls with parameters like this


The only imporant thing actualy is id which is id of the article. Articles were parsed so they have the oldarticleID so i can get them by id. I need to retain old urls along the old ones.

So i was thinking i will do something like this:

c::set('routes', array(
    'pattern' => 'index.php(:all)',
    'action' => function ($all) {
    	//parse query
    	parse_str($all, $output);
    	//find page with same id
    	$page = $site->search($output['id'], 'originalid');
    	return site()->visit($page);

But of course when you do index.php? and start parameters it goes imidiately to index.php so it doesnt work. If there is no ? then it works.

So is there a any way to do it in php or i need to touch webserver settings?

Thank you!

Using index.php as route pattern does not work unfortunately as it’s removed from the search string by Kirby, but you can use the following in your config:

if(str::startsWith(server::get('request_uri'), '/index.php?')) {
  if($page = site()->index()->findBy('originalid', get('id'))) {
  } else {


You just made it for me. Thank you Lukas. Works awesome.