Route pattern to match all except assets


#1

I have a route that matches everything. It’s placed after all the other routes to catch unmatched pages, which will then visit the error page.

// All kind of routes

// Catch unmatched and visit the error page
$kirby->set('route', [
	'pattern' => '(.+)',
	'action' => function() {
		return site()->visit( site()->errorPage() );
	}
]);

I really like this approach, because nothing will slip through unless I have routes for it. However, it also prevent the plugin assets to work. How can I fix it?

Match all

(.+)

Except

*assets/plugins/*